javascript - json data not load after load page -


this question has answer here:

i have read json data in javascript. json data not display first time page load, load after refresh page. please solve problem. here code:

$(document).ready(function () {   $.ajax({             url:"http://192.168.0.105/stratagic-json/project_json.php",             type:"get",             datatype:"json",             beforesend: function(){             success:function(jsondata){      var projctlist = '';    (var = 0; < jsondata.length; i++) {       projctlist += ' <li><div class="proj-details-wrap"> <img src="images/project-img.jpg" /><div class="proj-badge">upcoming projects</div><div class="proj-name">'+ jsondata[i].name +'<span>'+ jsondata[i].location +'</span> </div><div class="proj-status">'+ jsondata[i].percentage +'% <span>completed</span> </div></div><div class="container proj-desc">'+ jsondata[i].description +' </div> </li>';      }           $("#projctlists").html(projctlist);       }      });  }); 

a quick google search would've shown how use json.parse:

console.log(json.parse('[ { "id": "1", "title": "mr", "name": "neeraj", "mobile": "9076123344", "emailid": "neerajt43@gmail.com", "projname": "aryan heights", "subproj": "a wing", "unit": "pent house", "budget": "25 30 lacs", "comments": "this test comment" }, { "id": "3", "title": "mr", "name": "neeraj", "mobile": "9076554744", "emailid": "neerajt43@gmail.com", "projname": "aryan heights", "subproj": "a wing", "unit": "row house", "budget": "25 30 lacs", "comments": "this test" } ]'));


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -