Page 2 of 2

Re: how to implement cross domain

PostPosted: Mon Dec 23, 2013 4:27 am
by priya
Hi,

Sorry. I am not getting the solutions yet. I will clearly explain my issue with example. Using the ajax call i am calling one url in a function.

function getadv(){
var url;
$.ajax({
type: "GET",
url: "www.staging.com/MPFullScreenAds?date=2013-10-31&resolution=1080p",
async: false,
success: function(message){
var url=message.data.url;
}

});
vid_samp_url(url);
}

Using the first ajax call i am getting the xml url which i have to parse as the url for the second ajax call. I am getting the xml url dynamically. My application hosted server and the first ajax url are in the same server.

function vid_samp_url(xml_url){
$.ajax({
type:"GET",
url: xml_url,
async: false,
success: function(xml){
console.log("xml call succeed");
vid_url=$(xml).find("MediaFiles").text();
}
}
From the second ajax i have to get the video path but it is not calling the xml url which is in the another server. I am not using php in my app.

Can you please help me in this

Re: how to implement cross domain

PostPosted: Mon Dec 23, 2013 6:48 am
by Support_STA
The problem may be that you are using jQuery version 1.8 or newer in which synchronous ajax calls are deprecated. Please review the jQuery.ajax () documentation for the async property. A solution could be to move the call to vid_samp_url into the success function of getadv and setting async to true or removing it.

Please avoid synchronous requests, as they may potentially hang the browser for a long time.

Regards,
STA QA