开发者

jQuery: missing ] after element list

开发者 https://www.devze.com 2023-02-25 12:33 出处:网络
I have that error in the code below. What\'s wrong ? I have no ideas left. 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?

0

精彩评论

暂无评论...
验证码 换一张
取 消