I am trying to make simple ajax :
$('.send-contact-button').on('click', function(e){
e.preventDefault();
var id = $('.send-contact-button').data('id');
var flag = $('.send-contact-button').data('flag');
$.ajax({
method : 'GET',
url : "contactHandler?id="+id+"&flag="+flag,
success : function( data ){
console.log( data );
}
});
});
but every time i get the html content. Tryied to send the data through json but without result. This Ajax is just test. Controller:
public function contactHandler($id, $flag)
{
echo $id;
}
Can you guys tell me where i am wrong ? Thank you very much!