Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callback function not being included in response #32

Open
mii9000 opened this issue Jun 5, 2014 · 5 comments · May be fixed by #48
Open

Callback function not being included in response #32

mii9000 opened this issue Jun 5, 2014 · 5 comments · May be fixed by #48
Labels

Comments

@mii9000
Copy link

mii9000 commented Jun 5, 2014

I have the following in my Web API action:

[HttpGet]
public HttpResponseMessage GetProducts(string id)                
{
      var returnData = data;
      string callback = ControllerContext.Request.GetQueryNameValuePairs().Where(kv => kv.Key == "callback").Single().Value;    
      return Request.CreateResponse(HttpStatusCode.OK, returnData, new JsonpMediaTypeFormatter(new JsonMediaTypeFormatter(),callback), new MediaTypeHeaderValue("text/javascript"));
}

But it is responding with:
({.....}); instead of myCallback({....});

Where am I going wrong?

@mii9000
Copy link
Author

mii9000 commented Jun 30, 2014

Settled for enabling CORS on Web API project rather trying to handle JSONP calls. But this is still a issue though.

@langico
Copy link

langico commented May 16, 2016

image
why responding this?

@MingweiSamuel
Copy link

I am getting the same error

@MingweiSamuel
Copy link

added a quick fix #48

@MingweiSamuel
Copy link

R I P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants