0

So i've got a rails call, It works lovely and passes this into postman (shortened because its huge)

SEEvent({"event_id":"ID","date":"Sat 20 Aug 2016, 10:00","suppress_best_available":"","sorted_ticket_types":["000000000001"],"is_resale_eligible":0,"ada_tickets_enabled":0,"suppress_any_price":"","expand_resale_module_ntf":1,"expand_resale_module":"","bba_deep_links_offer_code":

For some reason when i try and call it in my javascript file (which looks like this):

$.ajax({
  type: 'GET',
  crossDomain: true,
  dataType: 'json',
  url: '/event/'+ event,
  success: function(json) {
    debugger;

The error function is shown instead of the success. In the debugger, i have response code 4 and in the response text is all the json i need.

Any help would be amazing

I've tried changing the dataType to jsonp which also didnt work.

Sam

2
  • The data shown seems to be JSONP, assuming the part you truncated ends with a closing bracket. I know you said you tried that, but it's definitely not JSON. Have you tried telling jQuery that the name of the JSONP callback should be SEEvent? Commented Aug 13, 2016 at 15:26
  • I havent tried this, I'm not sure how i'd do this? Could you provide an example? Commented Aug 13, 2016 at 15:51

1 Answer 1

1

The error is happening possibly because this bit - SEEvent( is not valid json. The server needs to send valid json only which can be parsed straight away.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.