Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

167
Views
how to retrieve json encoded multi dimension in php with javascript in ajax call

i received json as

[[{"tid":"1","sid":"1","tname":"Classical Mechanics"}],[{"examid":"1","sname":"Physics","ename":"CSIR-NET"},{"examid":"2","sname":"Physics","ename":"GATE"}]]

i need to get each item as array. i tried

success: function(msg){
                    console.log(msg);
                            for (var j in msg[0]) {
                              $('#tctop').append("  <option value="+msg[0][j]['sid']+">"+msg[0][j]['tname']+"</option>")
                            }
                            for (var j in msg[1]) {
                              $('#tcexm').append("  <option value="+msg[1][j]['examid']+">"+msg[1][j]['ename']+"</option>")
                            }
}

but it did not works.

for a try i defining var msg=[[{"tid":"1","sid":"1","tname":"Classical Mechanics"}],[{"examid":"1","sname":"Physics","ename":"CSIR-NET"},{"examid":"2","sname":"Physics","ename":"GATE"}]] and use the loop it worked. How to get a result when you receive response from ajax call

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!