I want cross domain data access for my project and I made it work but I am stuck with this popup which says This page is accessing information.
I don't want to suppress it by explicitly changing browser settings: can I modify my working code to suppress this message?
My working code with popup:
<script type="text/javascript">$.ajax({
url: "http://sys85/testservice/serviceCall.ashx",
dataType: "text",
type: 'get',
crossDomain: true,
success: function (data) {
},
error: function (jqXHR, textStatus, errorThrown) {
if (window.console) console.log("Error... " + textStatus + " " + errorThrown);
}
});
</script>
I have tried with the example given here: jsonp with jquery, but for my URL it doesn't work .
My handler file to return result (serviceCall.ashx):
string result = "121";
context.Response.ContentType = "application/json";
context.Response.Write(result);
Do I have to make any changes with my handler file?
When I try to add an error function to get error details:
$(document).ready(function () {
var url = "http://sys85/testservice/serviceCall.ashx";
$.getJSON(url + "?callback=?", null, function (data) {
alert(data);
})
.error(function (jqXHR, textStatus, errorThrown) {
console.log("Error... " + textStatus + " " + errorThrown);
document.getElementById('lblmsg').value = "Error... " + textStatus + " " + errorThrown;
})
});
I get this error: Uncaught TypeError: Object #<XMLHttpRequest> has no method 'error'
.
Tried every possible ways to get rid of this message.