I just want to send address information to drupal for check content existence through the AJAX.
Request is sending successfully and callback function also executing.
but I am not getting any data in $_POST
array.
here is my AJAX code.
var address = [{'add1':'address line1','add2':'address line2','add3':'address line3'}]
$.ajax({
url: Drupal.settings.property_check.base_url + '/search/property-by-address',
type: 'POST',
data: JSON.stringify(address),
headers:{
'Content-Type': undefined,
}
})
.done(function(response) {
console.log(response);
})
This is callback routing & function
$items['search/property-by-address'] = array(
'title' => 'property by address',
'page callback' => 'search_property_by_address',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
function search_property_by_address(){
drupal_json_output($_POST);
}
At where I am making mistake? is there any other way? Or is there any problem with headers
?