Robb Hill
asked on
jquery syntax error on Ajax call to mvc controller
I am trying to make an ajax call...that will grab the values off the page...and then pass those values in the URL to the controller.
Here is the ajax...its crapping out on the 2nd line starting with var allocation.
For greater detail here is the other parts of my code:
Here is where I call it.
Here is the ajax...its crapping out on the 2nd line starting with var allocation.
function UpdateContactEntity(clientxcontactId) {
var allocation = $("#txtallocation" + clientxcontactId + ).val();
alert(allocation);
$.ajax({
alert("test");
url: "/Contact.mvc/UpdateContactEntity?clientxcontactId=" + clientxcontactId + "?allocation=" + allocation,
type: 'GET',
cache: false,
dataType: 'json',
data: { data: clientxcontactId },
success: function (data) {
var result = $.trim(data.Result);
ShowGridRedraw();
},
error: function (request, status, error) {
alert(request.responseText);
}
});
}
For greater detail here is the other parts of my code:
Here is where I call it.
[System.Web.Mvc.HttpGet]
public JsonResult UpdateContactEntity(string data,int allocation)
{
var result = true;
int clientxcontactId = data.ToInt32();
IContactEntityEditService contactEntityEditService = DependencyResolver.Current.GetService<IContactEntityEditService>();
var updated = contactEntityEditService.UpdateContactClient(clientxcontactId,allocation);
result = updated;
return Json(result, JsonRequestBehavior.AllowGet);
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.