jquery - How to retrieve information from database based on some specific condition and load them into html table using PHP? -


i have search page 2 fields: state , city (both using html select tag), , using jquery validate 2 fields.

i using jquery's $.post() retrieve data database follow:

$.post('database.php',     {         state   :   $( '#state' ).val(),         city    :   $( '#city' ).val()     },      function(response)     {         alert(response);     } ); 

and database query used in database.php is:

select * my_tbl tb_state = '$state' , tb_city = '$city';   

so far ok , result correctly shown $.post() response, want retreive information in php, instead of jquery.

so question is:
possible convert $.post() response php or retrieve response in php? if yes how can that? if no how can retrieve database values html table based on above database query using php without refreshing same page or loading new page?

modify function follows

$.post( "database.php", { state: $( '#state' ).val(), city: $( '#state' ).val() })   .done(function( data ) {      $('#id_of element insert data').html(data );   }); 

update

$.post() jquery method retrieve data asynchronously. if want change data retrieval php, post these data using form or pass query string. on receiving php end accept these parameters using $_post / $_get method, trigger database query , send page.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -