I'm getting a JSON response from the server. Inside that JSON string I have HTML content which I need to display in a field. How do I do this?
A:
Is this what you need? What kind of field? If it's a div or p
var yourContent = "";
$(".selector").html(yourContent);
If it's textbox use
$(".selector").val(yourContent);
That's of course if you using jQuery
Leon
2009-08-27 07:52:28
A:
If the JSON result is say:
({
name: 'John'
})
We grab it and operate on it like so:
$.getJSON("http://yourjsonresource",
function(data){
$('h1#foo').text( data.name );
}
);
meder
2009-08-27 08:01:01