I am using jquery ajax $.get which calls a php script on my server and retrieves content from another site (domain). It return's the full web page ok. I then want to extract html data from the 'center' tag using the .find() method, but I am having some issues.
$("#btnGetData").click(function(){
$.get("pgiproxy.php",{ data: $("#formdata").serialize() },
function(result) {
alert($(result).find('center').html());
val = $(result).find('center').html();
alert(val);
$('#BFX').html(result);
alert( $('#BFX').find('center').html() );
});
});
The first 2 methods both return 'null', but when I insert the ('result') html into the #BFX div it displays correctly on my monitor, the final alert works correctly, it find()s the 'center' tag and displays the html data in the alert.
Can anybody see why I get 'null' returned (as in the first 2 alerts) when trying to 'find()' the 'center' tag from the returned ajax data 'result'.
Any help is appreciated
Nic.