0

I want to test the $img which holds the jsonp url for an image. What is the best practice?

Should I embed another $AJAX call?

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')
    }
Jens Bergvall
  • 1,617
  • 2
  • 24
  • 54

0 Answers0