0

I'm trying to build a small app that can navigate around another site more easily than changing the site url, (If possible I don't want to use an iframe). e.g. If I select an auction and property number I want the details of that property to be displayed on my page. I can do everything to get the html back I can even get to the tables, the one thing I can't do is add the html to my site! The jquery selects the number of tables, but cannot get at the html, even though I can alert it?

$('#ddlproperty').change(function(){
    var url = "aURL?Lot=" + this.value + "&Auc=" +  $("#ddlauction option:selected").val() ;
    $.get(url,function(data){
        var start= data.indexOf('<body');
        var end = data.indexOf('</body') + 7;
        var body = data.substring(start, end);
        alert(body);
        var content = $(body).find('table');
        $(content).each(function(index, value){ 
            alert($(this).html);
            //$("#content").append($(this).html);
        });
   },"html");
});

All I get when I alert $(this).html is javascript, see image.Web alert message

any ideas.

Anthony
  • 127
  • 1
  • 8

2 Answers2

1

If you want to get the html from an jQuery element try calling the html-function, like this:

$('body').html()

What you are seeing in the alert message is jQuery's html function definition.

Hoedje
  • 129
  • 4
0

Html is a built in function, the way you alert 'this' you are referencing the function you are in. So you are just displaying the plain txt/html of that function.

So try alerting content or start,end . See where that gets you

Yordi
  • 166
  • 7