asp.net mvc - Json response not getting updated in Firefox -
i have html span (class: displaytext) in mvc view has "typeid", , "idvalue" attributes. objective fetch displaytext property database table passed "typeid" , "idvalue".
i have number of such span in view, call following method in document.ready() function display text , show on view, users don't need wait.
$('span.displaytext').each( function (index) { var url = $('#urlgetdisplayname').val(); $.ajax({ type: "get", url: url, data: ({ typeid: $(this).attr('typeid'), value: $(this).attr('idvalue') }), success: function (result) { $('span.displaytext')[index].innertext = result; } }); })
in above code, urlgetdisplayname id of hiddenfield on mvc view contains url of following mvc controller action responsible bring display value database.
[httpget] public virtual jsonresult getdisplaytextbytype(string typeid, string idvalue) { string displaytext = ""; /* code call database method fetch text type, , assign displaytext */ return json(displaytext, jsonrequestbehavior.allowget); }
this works in ie , chrome, in firefox doesn't update value in span control. can monitor in firebug controller action being called , also, returns correct json response, doesn't update span. possible reason? , how fix it?
please try text()
or html()
instead of innertext()
.
like this,
$('span.displaytext')[index].text(result);
Comments
Post a Comment