Accessing cross-domain data using jsonp
Well, I'm trying to access php web service (returning jsonp and url format is http://service.com/service.jsonp). First it was failing silently. So, I tried debugging following code in direct Visual Studio and IE.

    <script type="text/javascript">
        $(document).ready(function () {
            $('#btnClick').click(function () {
                $.ajax({
                    url: "http://url.jsonp",
                    dataType: "jsonp",
                    jsonp: "data",
                    jsonpCallback: "jsonpcallback"
                });
     
                function jsonpcallback(data) {
                    alert('doinng it now');
                }
            });
        });
    </script>


After click, the data comes in VS (which is a correct jsonp output) but VS throws an error. Following is the result:

Copy code

    data({"code":001,"msg":"true","data":{"obj1":"val1","obj2":"val2"}})


Error in VS: Microsoft JScript runtime error: 'data' is undefined
Accessing cross-domain data using jsonp
===

Well, I'm trying to access php web service (returning jsonp and url format is http://service.com/service.jsonp). First it was failing silently. So, I tried debugging following code in direct Visual Studio and IE.

    <script type="text/javascript">
        $(document).ready(function () {
            $('#btnClick').click(function () {
                $.ajax({
                    url: "http://url.jsonp",
                    dataType: "jsonp",
                    jsonp: "data",
                    jsonpCallback: "jsonpcallback"
                });
     
                function jsonpcallback(data) {
                    alert('doinng it now');
                }
            });
        });
    </script>


After click, the data comes in VS (which is a correct jsonp output) but VS throws an error. Following is the result:

Copy code

    data({"code":001,"msg":"true","data":{"obj1":"val1","obj2":"val2"}})


Error in VS: Microsoft JScript runtime error: 'data' is undefined