0

My source code:

function getdata()
{$(document).ready(function(){
$('#data').load('getdata.php');

jsonStatus=eval("("+reqIntiAjax.responseText+")");

});
}
setInterval("getdata()",300);

my data: [{"data1":1,"data2":4}]

how to decode json data with jquery? im using getdata=eval("("+reqIntiAjax.responseText+")"); its not work

1 Answer 1

2

Use $.getJSON to have jQuery automatically parse the JSON for you, or use JSON.parse to decode the JSON yourself. There is absolutely no reason to use eval for this.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.