質問

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 :)

役に立ちましたか?

解決

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?

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top