Created
December 2, 2015 10:22
-
-
Save valdero/70a7137609da3e51a1d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Storing Ajax response in array for reuse | |
*/ | |
var ajaxResults = []; | |
function exampleAjaxCall() { | |
$('body').on('click', '.loader', function (e) { | |
var id = $(this).attr('pid'); | |
var data = { | |
pid: id | |
}; | |
$.ajax({ | |
url: '/Store/Details', | |
type: 'GET', | |
dataType: 'html', | |
data: data, | |
cache: false, | |
success: function (data) { | |
$('.panel').html(data); | |
ajaxResults.push(data); | |
} | |
}); | |
}); | |
} | |
function getPrevious() { | |
$('body').on('click', '.get-back', function (e) { | |
$('.panel').html(ajaxResults.pop()); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment