Question

I defined a variable in PHP

define("SOMETHING","Something text");

Then I have a PHP file (defined.php):

echo SOMETHING;

And my jQuery $.get request is:

$.ajax({ 
    type: "GET",   
     url: "/include/defined.php",   
     async: false,
     success : function(text)
     {
         response = text;
     }
});

I want to get in variable response "Something text" and not SOMETHING! Is there a way to do so?

Thank you so much :)

Was it helpful?

Solution

You have a scope error: SOMETHING is not defined at the moment of the echo call.

Maybe you forgot to include the file with your defined.php?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top