Passing additional data to jQuery.Ajax callbacks

Screenshot from:

jQuery makes it effortless to make additional data available from within the jQuery.ajax callbacks (success | error | complete) because within the callbacks, this refers to the object that was passed to jQuery.ajax. Knowing this, you can provide extra parameters that jQuery.ajax will ignore but you can access later. For example:

	url: ‘/‘,
	pudding: ‘chocolate’,
	success: function() {
		alert(this.pudding); //alerts chocolate
  • Nasir Khan

    That was Pretty easy . Thanks Man. Search on Stack over flow but din’t find an answer and you nailed it. Thanks it’s working