I am getting the data in json format as
{"a":null,"b":1001}
and I have hidden field as
<input type="hidden" name="test" >
Now I need to set the value of field test as 1001 on page load. With jquery I am able to get the value in json but for some reason not getting as how do i set 1001 as value to hidden field.
Updated info.
Below is function I m using
$.get( "getjobscategoryid", {subcategory:data} )
.done(function(json ) {
alert( "Data Loaded: " + json);
$('input[name=subcategoryid]').val(json.jobscategoryid);
alert(json.jobscategoryid);
});
data is the variable I m passing after capturing the text on page load.After I capture the text, I pass it to jquery get call and I can see that values are coming back perfectly.
and I get data as Data Loaded:[{"jobscategory":null,"jobscategoryid":1001}]
Not sure as why i get undefined message for alert.Let me check agian.