access jquery variable in php code in the same page -


this question has answer here:

how can jquery varaible value , use in clause of php. there way in same page?

jquery:

$(".some").click(function() {        var value = $(this).attr('rel'); } 

php:

$query = oci_parse($con,"select * cd cid = '".$_get["value "]."'"); 

what you're looking ajax. can't add elements' rel attribute value sql query, on clicking of element. can is, send request special page (or same page) fetch stuff database.

then, using response can make changes on body.

$(".some").click(function(){     var relvalue = $(this).attr('rel');  $.get("url_to_php_file", {value: relvalue}, function(data){   // make changes on current page  }); }); 

an example of making content of clicked element "loaded" when ajax response received :

$(".some").click(function(){     var relvalue = $(this).attr('rel');  var t=$(this);  $.get("url_to_php_file", {value: relvalue}, function(data){   t.text("loaded");  }); }); 

see more ajax : https://api.jquery.com/jquery.ajax/

see more jquery.get() : https://api.jquery.com/jquery.get/


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -