I am making a Cross Domain AJAX POST Call to my Rest WebService
This is my HTML Code
$(document).on("click", ".submit", function(e) {
var name = $('#name').val();
var mobile = $('#mobile').val();
var email = $('#email').val();
if(name==''||mobile==''||email=='')
{
alert('Please Fill All the Details');
return false;
}
else
{
var information = {
"name": name,
"mobile": mobile,
"email": email
}
var dataaa = JSON.stringify(information);
console.log(dataaa);
$.ajax({
type: 'POST',
url: 'http://192.168.2.46:8080/PostEx/test/testservice',
jsonpCallback: 'jsonCallback',
cache: true,
data: dataaa,
dataType: 'jsonp',
jsonp: false,
success: function (response) {
alert(response);
},
error: function (e) {
$("#divResult").html("WebSerivce unreachable");
}
});
}
});
<body>
<form method="POST">
<div class="required">
Name: <input class="required" type="text" id="name" name="name"> <span class="asterisk_input"> </span> </br>
Phone: <input type="mobile" id="mobile" name="mobile"> <span class="asterisk_input"> </span> </br>
E-mail: <input type="email" id="email" name="email"> <span class="asterisk_input"> </span> </br>
</div>
<input class="submit" type="submit">
</form>
</body>
I am observing under the Browser console
Sorry for the big image i don't know how to crop the picture .