I need to get the accept header as image/webp but instead I get only /.
How to do it in Ajax request? It happens in Ajax page only please some one help me to do it in Ajax PHP.
My Ajax code is
function showResult(str){
if (str == '') {
$('#clear').hide();
}else{
$('#clear').show();
$.ajax({
url: "<?=tep_href_link('ajax_search.php') ?>",
type: 'POST',
data:{type:'adavnced_search',str:str},
success:function(result){
$("#livesearch").html(result);
var numItems = $('.p_remove').length;
$('#livesearch').slideDown('fast',function(){
$('#overlay').css({'display' : 'block'});
});
}
});
}
}
Please help to get the required accept format as image/webp.
You should define the required content type in "Accept" under "headers":
function showResult(str){
if (str == '') {
$('#clear').hide();
}else{
$('#clear').show();
$.ajax({
url: "<?=tep_href_link('ajax_search.php') ?>",
type: 'POST',
headers: {
Accept: "Image/webp"
},
data:{type:'adavnced_search',str:str},
success:function(result){
$("#livesearch").html(result);
var numItems = $('.p_remove').length;
$('#livesearch').slideDown('fast',function(){
$('#overlay').css({'display' : 'block'});
});
}
});
}
}