0
At a certain point I need to request a json script from the server, but I’m making some changes and I’m getting errors that supposedly shouldn’t happen. The example below works perfectly well:
$(".script_episodios").html($("<script />", {
src: 'http://dominio.com/js/episodios.php'
}));
/*chamados os dados que foram gerados no script acima*/
console.log(dados_episodios);
When I make the same call to another unique domain to return json, it is no longer processed correctly
$(".script_episodios").html($("<script />", {
src: 'http://api.dominio.com/js/episodios.php'
}));
/*chamados os dados chamados no script acima*/
console.log(dados_episodios);
In the second example it seems that the script does not wait for the call to be completed before continuing and I get the error Uncaught ReferenceError: dados_episodios is not defined
, I have already consulted the return of both requests is equal, including the average time of the request is equal for both, how can I circumvent this error?
Both
src
are redirecting to the page: http://www.domain.com/. How can it be working there? :– LipESprY
One points to the local domain, the other points to the Ubdomain api
– Leo Letto
But this Domain.com domain does not lead to a file
json
. Used only as an example???– LipESprY
Based on parameters passed PHP searches the data and sends them back with json_encode
– Leo Letto