I have a php file (myxml.php) that uses a 3rd-party API to return XML. It echoes the XML on the last line.
$xml = file_get_contents($url);
echo $xml;
Another php file (index.php) uses jQuery to read this XML in:
$(document).ready(function(){
$.ajax({
type: "GET",
url: "myxml.php",
dataType: "xml",
success: function(xml) {
My index.php file needs to pass the myxml.php file a variable called 'searchitem' that it can use before calling the API.
How do I pass $searchitem to myxml.php ?
Also, for better performance, can I import the php variable $xml to my ajax code above without the need to echo it?
Thanks in advance
myxml.php- from a browser ?