php not returning data to query ajax function -


In my page I have an AJAX function to load data from php and its only posting is that the data Do not get back from the PHP page. Please see and tell me if I have a mistake in the code or not. Any help very well appreciated Apart from this, all this is going to be refreshed without it.

  $ ('# filterByPrice button', '#filterByPrice button'). Click (function (e) {e.preventDefault (); var form = $ (This) .closest ('form'); $ .ajax ({url: 'filter-data.php', type: 'post', Data: form.serialize (), success: function (data) {$ ('. Container'). Html (""); $ ('container'). Html (data);}});});  

And the PHP file is:

  & lt ;? Php if (isset ($ _ POST ['filter'])) {$ searchStr = $ _SESSION ['search string']; $ Filter = $ _POST ['filter']; If (! Is_array ($ filter)) {require_once ('Connection / conn.php'); $ Stmt = $ conn- & gt; Prepare ("Choose from * Happy Where (Like City: Like Keyword or Zipcode: Keywords) and Cost = '$ Filter'"); } And {$ filter = implode (',', $ _POST ['filter']); Require_once ('Connection / conn.php'); $ Stmt = $ conn- & gt; (Choose from * Select * where Happy (Like City: Like Keyword or Zipcode: Keywords) and Days like 'Dafar' 'Day');} Execute {$ Stmt- & gt; (Array (': Keyword' = & Gt; $ searchStr. '%'));} Hold (PDOException $ ex) {echo $ ex-> getMessage ();} $ count = $ stmt-> gt; punctiquity (); $ Get each = $ stmt-> (PDO :: FETCH_ASSOC); if ($ count> 0) {do} {echo ' & Lt; / A & gt; & Lt; / TD & gt; & Lt; Tr & gt; & Lt; Font-size: 16px; font-family: \ 'a much anticipated pro \', font-weight: 500 "width =" 560 "height =" td id = "hh- name" style = "word-wrap: break-word; 20 "& gt; & Lt; '. $ Every ['name']. ' & Lt; / Td> & Lt; / Tr & gt; & Lt; TR & gt; & Lt; TD & gt; & Lt; A href = "'. $ Each [[GoogleMap]]." "Target =" new "style =" font-size: 14px "& gt; '. $ Each [' address '].' & Lt; / a & gt; & lt; / TD & gt; & lt; / tr & gt; & lt; tr & gt; & lt; td style = "word-wrap: break-word; Font-size: 14px; Font-family: \ 'much anticipated pro \' "height =" 20 "& gt; '$ every [' phone '].' & Lt; / td & gt; & lt; / tr & gt; & lt; tr & gt; & lt; td style = "word-wrap: break-word; Font-size: 14px; Font-family: \ 'much anticipated pro \' "height =" 20 "& gt; '$ every [' buyer '']. '& Amp;; & nbsp; & nbsp; (' [hours '].' $ Each . ') & Lt; / TD & gt; & lt; / TR & gt; & lt; / table & gt;';} while receiving ($ every = $ stmt- & gt; (PDO: FETCH_ASSOC)) ;}}? & Gt;  

You can repeat the same : Many times in the keyword placeholder, you must give them a different name.

  if (! Is_array ($ filter)) {require_once ('connections / conn.php' ); $ Stmt = $ conn- & gt; Prepare ("Choice Do not * Really Happy (Where: Like City or Zipcode: ZIP) and Cost =: Filter ");} and {$ filter = implode (',', $ _POST ['Filter']); require_once ( 'Connection / conn.php'); $ Stmt = $ conn- & gt; Prepare ("Select from where Happy * (like city: like city or zipcode: zip) and like day like TheWeek: Filter" );} Execute {$ Stmt-> (Arrays (': city' => $ searchStr. '%', ': Zip' = & gt; $ SearchStr '%', ': Filter' = & gt; $ Filter);) } Hold (PDOException $ ex) {echo $ ex-> GetMessage (); }  

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 -