开发者

$.getJSON difference between Firefox and Internet Explorer

Spent a while searching on this and found nothing that related directly. I have resolved the issue, but wonder why it is so. Maybe someone can answer this. Maybe this info will help someone else.

My javascript was as such:

v开发者_开发百科ar userServicePath = serverPath + '/Login/RegisterUserDetails/' + userId;
$.getJSON(userServicePath, null, createAndPopulateHiddenFields);

My Controller ran a query, populated an object and returned the object via:

return Json(qry, JsonRequestBehavior.AllowGet);

This worked fine until I added a few more fields. After modifying the object and controller, my response in IE showed null for my new fields. The breakpoint on the return value in the controller verified the new values were getting into the object properly. Even Firebug showed the values.

Just an FYI, my routing in MVC is set up with an id value for the third value in the url. Anyone have any ideas why this would work in FF, but not in IE.

And for the fix,... I removed the userId from the userServicePath string and added it as a parameter in the getJSON code.

var userServicePath = serverPath + '/Login/RegisterUserDetails';
$.getJSON(userServicePath, { id: userId }, createAndPopulateHiddenFields);

If anyone has an answer, that would be great. Otherwise, hopefully someone else in my shoes can spend less time searching for an answer and move on.


Answering my own question here:

var userServicePath = serverPath + '/Login/RegisterUserDetails';
$.getJSON(userServicePath, { id: userId }, createAndPopulateHiddenFields);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜