javascript - using integer received on js function as param to fetch div id with same id as passed integer as param -
i'm receiving integer on js function parameter , want utilize value represents div id append result within div.
function displaysomedata(somedata, code) { $.ajax({ url: formaturl('...'), type: 'post', contenttype: 'application/json', data: json.stringify({ data: somedata}), success: function (result) { $("#+code").html(result);// how utilize code recognize div id? }, error: ... });
you aren't concatenating selector string correctly. seek this:
$('#' + code).html(result)
javascript jquery
No comments:
Post a Comment