jQuery: missing ] after element list
I have that error in the code below. What's wrong ? I have no ideas left.
missing ] after element list
[object XMLHttpRequest]
$(function () {
开发者_运维技巧 setInterval($.post('/Sale/UpdatePrice',
{SaleId : @Model.Id},
function(data){
$('#mPrice').val(data);
}
)
,5000); //refresh every 5 seconds
});
C#
public JsonResult UpdatePrice(int SaleId)
{
...
return Json(NewPrice, JsonRequestBehavior.AllowGet); //NewPrice is a decimal
number
}
Doesn't it need to be in a closure,
$(function () {
setInterval(function() {
$.post('/Sale/UpdatePrice',
{SaleId : @Model.Id},
function(data){
$('#mPrice').val(data);
}
)}
,5000); //refresh every 5 seconds
});
Sorry for being Capt. Obvious here, but it seems that the JSON returned is missing a ] to end the array, Can you please post the JSON?
精彩评论