javascript - Why won't JSON accept my PHP variable? -


I can not get jQuery.ajax calls to use my PHP string variable < Code> $ defaultTicker . I have tried encoding for utf8 and trim any kind of "special" characters, but nothing has been able to help if I see the page source, then I see a valid JSON array : {"ticker": "spy", "startday": 1, "and de": 30} .

Here's my jQuery for submitting data:

  $ .ajax ({url: "findCorrelated.php", // why not   

As an idea why failing to deposit using PHP variables? If I type SPY to & lt; Default of in the hardcode , then it will be successful. However, when looking at the source, the results appear the same.

Note: I am not using json_encode on a PHP array, because startday and endDay value coming Client-side JavaScript

EDIT: The real problem was with Chrome's browser settings in fact it was caching my JavaScript and ignoring any updates in the files, so I kept the change and did the same Received results.

itemprop = "text">

This is probably because your server does not have configuration enabled.

Because of this, the following line is not parsed as a PHP code, but rather considers it plain text.

  "ticker": "& lt;? = $ DefaultTicker?>,   

Use this instead: < pre> "ticker": "& lt; php echo $ defaultTicker ;?"

The short tag is considered to be a pod in the coding world, because if you ever It also needs to migrate the code that does not support it, or you can not enable it when you just go with the normal tag, then you have to edit all your code for that environment however < / em>, in the form of 5.4.x A., default are less capable hands tagged and parsed in any PHP document. But it is good to keep in mind the different environments.

Comments

Post a Comment

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -