I want to get stored value in my defined variable. I have written this code:
var phn=$.ajax({
url: ipaddress+"/.../.../...",
type: "POST",
data: JSON.stringify(MyForm1),
contentType: "application/json; charset=utf-8",
success:function(response){
console.log(response);
$.each(response, function(k, v) {
rcvdResponse.push(v);
console.log(rcvdResponse);
});
var phone =rcvdResponse[0];
return phone;
}
});
rcvdResponse is a defined array. But it is not returning the output. Can anyone help me to do it?