admitme_sam admitme_sam - 7 months ago 26
Javascript Question

rails passes json to javascript file, But javascript shows error

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):

type: 'GET',
crossDomain: true,
dataType: 'json',
url: '/event/'+ event,
success: function(json) {

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.



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.