Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var dfd = {
- resolve : function (res) {
- $("#Div123").html(res);
- }
- };
- function getAjaxResponse(page, responseType, dataVar, dataVal, dfd) {
- var dataObject = $.parseJSON('{"'+ dataVar +'":"'+ dataVal +'"}');
- $.ajax(page, {
- type: 'POST',
- dataType: responseType,
- data: dataObject,
- success: function (responseData) {
- dfd.resolve(responseData);
- }
- });
- }
- $(document).ready(function(){
- $("#submit").click(function(){
- getAjaxResponse("ajaxreponse.jsp", "text", "aa", "yes", dfd);
- });
- });
- data: { dataVar : dataVal }
- dataType: isJSON ? "JSON" : "text
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement