Hi,
I have the below code and it works fine except the part where I need to access data.Picture. I know its a syntax error but I can't seem to understand what.

$.post("rpc.php",arr, function(data)
{
$('#dorants').append(data);
$('#dorants').append(data.Picture);

Like always appreciate the help :)

Recommended Answers

All 4 Replies

Try with this while appending the response data to the div,don't know whether that works..

$('#dorants').html(data);

HI,
I was hoping I could access the variable in data by something like data.Picture ?

$('#dorants').append(data.Picture);

Ok..I think you can do it in jQuery.Suppose want to access class test which is the response html.Put a div outside it on the page(rpc.php)like ..

<div><div class="test"/> </div>

With tha Ajax response data
ie,

$.post("rpc.php",arr, function(data)
{
//We won't get html from 'data' because it is variable, so
   var content = $(data).find('.test').html();
   $('#dorants').append(content);

@developer thank you it worked !!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.