javascript - How to get value of jquery variable into php variable without ajax? -
javascript - How to get value of jquery variable into php variable without ajax? -
my js :
$('#affiliates_name').change(function(){ var id = $('#affiliates_name').val(); });
and html is:
<select id="affiliates_name" style="display: none;" name="affiliates_name"> <?php foreach($users_names $value){ echo "<option value='".$value['id']."'>".$value['first_name']." ".$value['last_name']." (".$value['id'].")</option>"; }?> </select> <?php $get_value ?>
and want var id
value in php variable $get_value
without ajax, using jquery.
as other members suggested, should read ajax , difference between server-side , client-side code. however, if correctly understand willing do, don't need of those. if want display different content according alternative chosen user can maniupulate dom construction using jquery wrote before. may find this useful. in simple way may this:
<script> $('#affiliates_name').change(function(){ var id = $('#affiliates_name').val(); //changing content of div. $("#container_for_manipulation").html("some content added div according "+id+" value") }); </script> <select id="affiliates_name" style="display: none;" name="affiliates_name"> <?php foreach($users_names $value){ echo "<option value='".$value['id']."'>".$value['first_name']." ".$value['last_name']." (".$value['id'].")</option>"; }?> </select> <div id="container_for_manipulation"></div>
javascript php jquery ajax
Comments
Post a Comment