jquery - Using a PHP variable passed via AJAX -


I am searching for an answer but in fact I do not have any requirements.

Everything is working fine, variables are being sent through AJAX to my PHP file, but now I have to know how to actually use it (the WHERE field of a mysql query for).

First, the user clicks on something and calls this AJAX:

  $ Ajax ({type: 'post', url: 'include / hash.php', data: {d: $ (s) .attr ('id')}, success: function (data) {console.log (data) ;}});  

then defines the PHP variable from the hash.php AJAX post:

  & lt ?? Php if (($! _POST ['d'])) $ $ hash = $ _POST ['D']; }? & Gt;  

And I want to display it in home.php in the following HTML:

   & Lt ;? Php echo $ hash; ? & Gt; & Lt; / Article & gt; & Lt; / Section & gt; Updated: Sorry to be ambiguous, I click on a link to the relevant HTML embedded user, and I eventually get the  WHERE  of a query based on the ID of that link.  
/ Code> want to generate fields So I'm passing the Ax to the PHP file hash.php . Right now, it is not working in the MySQL query, so I'm just trying to resonate the variable for debugging purposes, but I get an error from PHP that it is undefined. I do not know how to use outside of hash.php after being defined through AJX. Can I use variables only in hash.php , or can I access it in another file? I tried to include the hash.php in HTML, but despite the console log it is still unwanted that it is telling me that it is being passed

I bet my own $ ($) which causes problems.

If you post your HTML code, make sure that you reference $ (S) correctly, so we can all see that $ (S) What is the meaning.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -