Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
1. Application Jquery -



$(function () {


$.ajax({
type: "GET",
url: "http://myurl.com/count.ashx?a=1",
crossDomain: true,
contentType: "application/json; charset=utf-8",
dataType: "jsonp",

success: function (data) {
debugger;

$.each(data, function (index, value) {
debugger;
$("#mcount").text(value.InvestmentPraposalCount);

});

},
error: function (xhr, status) {
debugger;
console.log(status);
console.log(xhr.responseText);
}
});

function callbackFunc(resultData) {
alert(resultData);
}

});




2. Web Service Response Data-

[{ "InvestmentPraposalCount" : "0", "HostingIncubatorProposalCount" : "2", "StartupEnrollmentCount" : "7", "Totals" : "9"}]




when i try to get and set data in our application url from service hosted at another location... it gives me error
Error: Permission denied to access property "apply"
and parseerror.

Please help me out ?

What I have tried:

i have tried doing it in jsonp and crossdomain work in ajax request and also done changes in web.config of application for resquest and response headers. but all does not work..

Kindly help us out.
Posted
Updated 2-Jan-17 23:31pm
v2

1 solution

Changed Json response with below

jsonCallback({ "InvestmentPraposalCount" : "0", "HostingIncubatorProposalCount" : "2", "StartupEnrollmentCount" : "7", "Totals" : "9"})


& and added
jsonpCallback: 'jsonCallback',
option in ajax script of jquery for retriving data...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900