javascript - How can I point to a url full of json value and eval parse it, using json2.js? -


how can parse eval object json2 dot js?

there url http: //blah.com/json.data want call button this

<input type="button" value"go" onclick="go()" />

from go javascript function, want hit blah url has type of data-content (it has no html) on page: userdetails.attribute.name=lastname userdetails.attribute.value=smith userdetails.attribute.name=givenname userdetails.attribute.value=michael

how can use eval() function throw of data blah url var object1 can this:

document.getelementbyid("lname").innerhtml = object1.blah[1].lastname;

thanks in advanced...i'm new json2 start using it.

use jquery:

$.get({   url: "/json.data",   datatype: "json",   success: function (result) {     $("#lname").text(result.blah[1].lastname);   } }); 

if data formatted posted in example (which not valid json), may need parse hand. can tell jquery send plain text instead of attempting parse response setting datatype setting text.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -