ajax - MVC/JQuery Input set Value with .val() -
i have input element setting value nothing initially:
<input id="foovalue" type="hidden" data-url="@url.action(mvc.foocontroller.foovalue())" value="" />
i have ajax call retrieve value , try pass input , set blank value new value:
$.ajax({ type: 'get', url: $('#foovalue').data('url'), success: function (data) { $('#foovalue').val(data); } });
when perform ajax request in firebug console value of 4, when got value input isn't returning anything. can me , tell me why appear value not being set ajax request? thanks.
the following post might helpful. although example involves hidden field think may able fix problem removing value=""
html described in blog post.
Comments
Post a Comment