Click here to Skip to main content
11,709,536 members (46,798 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: JSON JSONP
I am using following link to make jsonp call https://raw.github.com/betamax/getImageData/master/jquery.getimagedata.js[^]

My jsonp call
$.jsonp({
                   //async: true,
                   //crossDomain: true,
                   type: 'GET',
                   timeout: 10000,
                   url: 'http://sys108/vbr/Handler.ashx?imgURL=' + encodeURIComponent(imageURL) + '&type=crossDomainImage',
                   dataType: 'jsonp',
                   contentType: "application/json; charset=utf-8",
                   success: function (data) {
                       console.log(data.ImageData);
 
                   },
                   error: function (data) {
                       console.log('error');
                   }
               });
My response method
string imgData= processCrossDomainImage("");
context.Response.ContentType = "text/javascript";
string strJson = "{  \"ImageData\" : \"" + imgData + "\" }";
            //if (context.Request.QueryString["callback"] != null)
            //{
            //    strJson = context.Request.QueryString["callback"] + "(" + strJson + ")";
            //}

            context.Response.Write(strJson);

Above code gives me error "Uncaught syntax error Unexpected token :
My response looks like
{  "ImageData" : "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAICAgICAQICAgIDAgIDAwYEAwMDAwcFBQQGCAcJCAgHCAgJCg0LCQoMCggICw8SPzI5+pJ/DAr8zxPHfFuPrKdXH1XZp6TaV+mkWl+HkfT08nwGGhpRjrpblW3XW1/L/hj8z/AA/qi634L03VAArXMCs6jorY5Faxb1s2k9F5JdvmdGEwFDLqXsqXXVt7vt919A5AA6Y7UUi/6tfpS1+yHcFFFFAH/2Q==" }

Not sure but i am doing something wrong with response settings.Please help.
Posted 22-Apr-13 1:24am
Comments
Prasad Khandekar at 22-Apr-13 15:44pm
   
You do not seems to have "?callback=?" In your URL.

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 590
1 OriginalGriff 250
2 Maciej Los 225
3 Peter Leow 219
4 Mika Wendelius 160
0 OriginalGriff 9,428
1 Sergey Alexandrovich Kryukov 9,027
2 CPallini 5,189
3 Maciej Los 4,991
4 Mika Wendelius 3,856


Advertise | Privacy | Mobile
Web02 | 2.8.150819.1 | Last Updated 22 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100