I am trying to make the simplest API between one site and another, try to implement the simplest option, namely, just send a request to the php page of the site and get back the data that it will leave.
on the server there is such php file:
$v['id'] ='11'; $v['nn']='22'; echo json_encode($v); just generates a test string in jason
and this is how I try to send a request for receiving data from this file.
jQuery.ajax({ url: "http://www.****.com/hyst/acore.php", type: "GET", contentType: 'application/json; charset=utf-8', success: function(resultData) { alert(resultData); }, error : function(jqXHR, textStatus, errorThrown) { alert(textStatus); } }); but unfortunately, I get an error, where was I wrong? Is it appropriate to use Ajax here if the domains of the site with the API and the site that sends the request are different? if not ayaks then how best to do?
header('Content-type: application/json');on PHP server send to browser / client? - XelaNimed 1:54 pm