Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

convert json array to variables

JSON innerHTML json array

  • Please log in to reply
No replies to this topic

#1 Demodog

Demodog

    CC Lurker

  • Just Joined
  • Pip
  • 9 posts

Posted 14 April 2010 - 11:25 PM

Hi!

In an ajax call, how do I in the most simpliest way convert php array variables from:

$arr = array ('name'=>'John','adress'=>'greenroad 2');
echo json_encode($arr);

into javascript variables:

var name
var adress

I want to be able to print them out in seperate DIVs by using:
document.getElementById('namediv').innerHTML = name;
  • 0





Also tagged with one or more of these keywords: JSON, innerHTML, json, array

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download