﻿/**
 * jquery.ajaxpro
 * This plugin is to integrate jquery with AjaxPro.Net
 * NOTE : The success/failed/error... functions of jQuery.ajax use "res" as the returned value, 
 *        but the jQuery.ajaxpro use "res.value" instead.
 */
(function($){

jQuery.extend({
	ajaxpro : function(vMethod, vOptions) {
		var options = jQuery.extend({}, vOptions, {
			type : "POST",
			contentType: "application/json; charset=utf-8",
			dataType: "json",
			url : Environment.AjaxUrl,
			beforeSend : function(xhr) {
				xhr.setRequestHeader("X-AjaxPro-Method", vMethod || "");
			}
		});
		jQuery.ajax(options);
	},
	getAjax : function() { return Environment.Page; }
});

})(jQuery);

