我想测试一个$ img,它包含一个图像的jsonp url。 什么是最佳做法?
我应该嵌入另一个$ AJAX电话吗?
var ebRand = Math.random()+'';
ebRand = ebRand * 75;
var URL = 'http://ox-d.bbt.com/w/1.0/arj?o='+ebRand+'&auid=258624&c.env=rvw';
$.ajax({
async:true,
url: URL,
dataType: 'jsonp',
crossDomain: true,
success: openX,
errror: errorX,
jsonpCallback: 'openX'
});
function openX(data) {
alert('SUccess however load function error.')
var ad = data['ads']['ad'][0]['html'];
$img = $(ad).find('img').attr('src');
//I WANT TO TEST THE $IMG which holds the jsonp url for an image.
//What is the best practive should I embedded another $AJAX call?
console.log(data);
}
function errorX(data){
alert('Error')
}