Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. var dfd = {
  2. resolve : function (res) {
  3. $("#Div123").html(res);
  4. }
  5. };
  6.  
  7. function getAjaxResponse(page, responseType, dataVar, dataVal, dfd) {
  8. var dataObject = $.parseJSON('{"'+ dataVar +'":"'+ dataVal +'"}');
  9. $.ajax(page, {
  10. type: 'POST',
  11. dataType: responseType,
  12. data: dataObject,
  13. success: function (responseData) {
  14. dfd.resolve(responseData);
  15. }
  16. });
  17. }
  18.  
  19. $(document).ready(function(){
  20. $("#submit").click(function(){
  21. getAjaxResponse("ajaxreponse.jsp", "text", "aa", "yes", dfd);
  22. });
  23. });
  24.  
  25. data: { dataVar : dataVal }
  26.  
  27. dataType: isJSON ? "JSON" : "text
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement