i want to request as json to API and get response and i tried it with postman and i got response:
json request to API:
{
"apikey":"&^$%#@!jwebdpqodp9fgkwjebfkdpqihdqlwkndqp"
}
response that i got in postman and it is ok
{
"status": 200,
"result": {
"winner": "s",
"options": {
"1": "mar",
"2": "feb",
"3": "jan",
"4": "aug"
},
"question": "how old are u?",
"answer": 3
}
}
my problem is i want to send ajax request and get response.i try this code but it doesnt get any response?
var data = {"apikey":"&^$%#@!jwebdpqodp9fgkwjebfkdpqihdqlwkndqp"};
$.ajax({
type:'post',
dataType:'json',
url:'http://207.154.251.233:8039/app_dev.php/question/get',
data:JSON.stringify(data),
success:(function (response) {
alert(response);
})
})