Reputation: 3
In www.example1.com/demo.php I have a variable named
$x=5
I want to display the value of $x in www.example2.com
How to do it?
www.example2.com does not have server-side language support. Can I do it with JavaScipt or does it have a another way to accomplish it?
Upvotes: 0
Views: 127
Reputation: 61
javascriptWantValue.js :
// show the waiting circle gif animation ;
$("#waitingCircle").css("display", "block");
$.ajax({
url: "getValueFromPhp.php?"+paramOptional,
dataType: "text",
async: true,
success: makeuseofValueFromPhp
});
function makeuseofValueFromPhp(valueFromPhp, status123, XHR123) {
console.log("value from php is : " + valueFromPhp);
// hide the waiting circle ;
$("#waitingCircle").css("display", "none");
}// end function makeuseofValueFromPhp()
getValueFromPhp.php is :
<?php
$x = 5;
echo $x;
?>
Upvotes: 1