Link to home
Start Free TrialLog in
Avatar of Robb Hill
Robb HillFlag for United States of America

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.

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);
        }     
     });
}

Open in new window


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);
        }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of zephyr_hex (Megan)
zephyr_hex (Megan)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial