Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can i send javascript variable values into php
    text
    copied!<p>How can i send javascript variable values into php. i have used ajax for this but its nt working for me. please help, i am new in javascript and ajax. Here is my ajax &amp; javascript code.</p> <pre><code>&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js"&gt;&lt;/script&gt; &lt;link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css" type="text/css" /&gt; &lt;script type="text/javascript"&gt; $(function () { $("#slider-range").slider( { range: true, min: 71, max: 109, values: [75, 100], slide: function (event, ui) { $("#size-range").html(Math.floor(ui.values[0] / 12) + "'" + (ui.values[0] % 12) + '" - ' + Math.floor(ui.values[1] / 12) + "'" + (ui.values[1] % 12) + '"'); $("#min_inches").val(ui.values[0]); $("#max_inches").val(ui.values[1]); } }); $("#size-range").html(Math.floor($("#slider-range").slider("values", 0) / 12) + "'" + ($("#slider-range").slider("values", 0) % 12) + '" - ' + Math.floor($("#slider-range").slider("values", 1) / 12) + "'" + ($("#slider-range").slider("values", 1) % 12) + '"'); var a = $("#min_inches").val($("#slider-range").slider("values", 0)); var b = $("#max_inches").val($("#slider-range").slider("values", 1)); $.ajax( { type: "POST", url: "searchrange.php", data: { a: a, b: b }, success: function (option) { alert("voted"); } }); }); &lt;/script&gt; </code></pre> <p>And Below is my php code(searchrange.php).</p> <pre><code>&lt;?php if(isset($_POST['a']) &amp;&amp; $_POST['a'] != '') { $kws = $_POST['a']; $kws1=$_POST['b']; echo $kws; echo $query = "select * from newusers where Age between '".$kws."' and '".$kws1."'" ; $res = mysql_query($query); $count = mysql_num_rows($res); $i = 0; if($count &gt; 0) { echo "&lt;ul&gt;"; while($row = mysql_fetch_array($res)) { echo "&lt;a href='#'&gt;&lt;li&gt;"; echo "&lt;div id='rest'&gt;";?&gt; &lt;a href="searchrange.php?id=&lt;?php echo $row['0'];?&gt; "&gt;&lt;?php echo $row['Religion'];?&gt;&lt;br&gt;&lt;?php echo $row['Name'];?&gt;&lt;/a&gt; &lt;?php echo $row[0]; echo "&lt;br /&gt;"; echo "&lt;br /&gt;"; echo "&lt;div style='clear:both;'&gt;&lt;/div&gt;&lt;/li&gt;&lt;/a&gt;"; $i++; if($i == 5) break; } echo "&lt;/ul&gt;"; if($count &gt; 5) { echo "&lt;div id='view_more'&gt;&lt;a href='#'&gt;View more results&lt;/a&gt;&lt;/div&gt;"; } } else { echo "&lt;div id='no_result'&gt;No result found !&lt;/div&gt;"; } } ?&gt; </code></pre> <p>Any help would be appreciated. thank you</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload