jsnag
jsnag

Reputation: 113

PHP and JQuery Question

Is there a way I can pass a PHP variable from a PHP page to a JQuery page and back to a PHP page?

Upvotes: 1

Views: 114

Answers (1)

Frankie
Frankie

Reputation: 25165

Maybe I'm wrong but I believe you may be confusing things.

  1. Server Generates page using PHP.
  2. Generated page is composed of HTML, JAVASCRIPT whatever...
  3. Client receives page
  4. Received page is interpreted (JavaScript code is run)

In the end what you are asking for is possible but, by the way you put the question, I though that the above should be clarified.

How to do it?

Say you want to pass id=123 from server to client and then back.

  1. generate page with a tag, say <span id="js-val">123</span>
  2. have client read the contents of id="js-val
  3. client can then resend the 123 using POST or GET that really depends on what you want.

Hope it helps to clear things up.

Upvotes: 2

Related Questions