I have an array like this:
var nums=["21", "22", "23", "20", "19", "18"];
and this JQuery Ajax codes:
$('#chk').click(function () {
$.ajax({
url: "/BarberShop/ServiceUpdate",
type: "Post",
data:{ nums: nums},
dataType: "json",
success: function (data) {
}
});
});
and Controller Action like this:
[HttpPost]
public ActionResult ServiceUpdate(string nums)
{
//Do something......
return View();
}
the problem is when I Post the array using ajax nums
parameter in Controller Action is null
and also server gives me this error:
POST http://localhost:18322/BarberShop/ServiceUpdate 500 (Internal Server Error)
n.ajaxTransport.k.cors.a.crossDomain.send @ jquery-2.1.4.min.js:4n.extend.ajax @ jquery-2.1.4.min.js:4(anonymous function) @ Barbershop:481n.event.dispatch @ jquery-2.1.4.min.js:3n.event.add.r.handle @ jquery-2.1.4.min.js:3
I have tried all answer in this links and some others:
500-internal-server-error-on-jquery-ajax-post-asp-net-mvc
pass-array-to-ajax-request-in-ajax
but still have the problem.thanks