i want to create a search functioanlity for my real estate website.here i have created search criteria and to fullfill this criteria i have used a jax call. this ajax will call php file and that file will send data to search page . here is my sample code. i dont know what issue is there. thanks in advnce
function searchBuy() {
//alert("search Loaed");
$.ajax({
url: 'searchBuyCriteria.php',
type: 'POST',
//dataType: "json",
data: {
cat: $('#SelectCat').val(),
MaxArea:$('#SelectMaxArea').val()
}
}).success(function(data){
console.log("Success"+data);
alert(JSON.stringify(data));
}).error(function(data){
console.log("Error"+data);
});
} </scipt>
searchCriteria.php
<?php
include_once('_secure/conn.php');
$city = $_POST['SelectCity'];
$cat= $_POST['SelectCat'];
$rooms = $_POST['SelectRooms'];
$minRange = $_POST['SelectMinRange'];
$maxRange = $_POST['SelectMaxRange'];
$minArea = $_POST['SelectMinArea'];
$maxArea = $_POST['SelectMaxArea'];
$conn=mysql_connect(DB_HOST,DB_USER,DB_PWD,DB_NAME);
mysql_select_db(DB_NAME);
$Searchqry ="Select * from tblcategory where category_title like '%".$cat."%' ";
$searchExec = mysql_query($Searchqry) or die(mysql_error());
$searchRow = mysql_fetch_array($searchExec);
//echo $searchRow;
echo json_encode($searchRow);
?>
conn.php
<?php
session_start();
ob_start();
if(!isset($path))
$path="./";
elseif($path=="")
$path="../";
require_once("settings.inc.php");
$database='srijanip';
$user='srijanip';
$pass='********';
$host='example.*****.in';
define("DB_HOST", "$host");
define("DB_NAME", "$database");
define("DB_USER", "$user");
define("DB_PWD", "$pass");
?>