USING GET METHOD FETCHING HTML DATA, GETTING WRONG RESPONSE RESULT

Simons Hood

Total Post:70

Points:494
Posted by  Simons Hood
JQuery 
 1193  View(s)
Ratings:
Rate this:
Hi Expert!

I am using jQuery get method to load html's data to store in to my array, for that i use this method:

line of code are given

var temps = function(views){
    var tempts = [];
    $.each(views, function(i,view){
    if(view){
        tempts.push($.get("templates/" + view + ".html"), function(data){
        console.log(data);//i am not getting response text.. getting array object.
    })
}
})

while I console the data i am getting a array object as like this:

[Object { readyState= 4,  responseText="<div id="login">\n  <form...eldset>\n   </form>\n</div>",  status=200,  more...}, function()]

please help me!
Thanks in advance!

  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: using get method fetching html data, getting wrong response result

    Hi Samuel!


    Try as following:

    tempts.push($.get("templates/" + view + ".html", function(data){console.log(data);}));

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!