I am trying to find the correct syntax to pass a varible to my JQuery Post.
var id = empid;
$.ajax({
type: \"POST\",
url: \"../Webservices/EmployeeS
Though not a direct answer to your question, following is the common function approach used in one of our projects for jquery calls
$.proxy() Method
The Proxy method takes an existing function and returns a new one with a particular context.
Syntaxes
$(selector).proxy(function,context)
$(selector).proxy(context,name)
CODE
dpInvokeAsync: function (serviceRequest, input, requestType, successCallBack) {
var url = BASE_URL + serviceRequest;
$.ajax({
type: requestType,
url: url,
async: true,
data: input,
dataType: 'json',
success: $.proxy(successCallBack, this),
error: $.proxy(this.handleFailure, this)
});
}
this.dpInvokeAsync('App/ShowParts', searchCriteria, 'Post',
function (result) { alert(result);}
);
REFERENCES