devOp
devOp

Reputation: 3170

Cross-domain request with ajax without json-data

I want to make a cross-domain request with ajax to get non-JSON(!) data (CSV-File). I'm using following code:

$.ajax({
      "url": dataset.url,
      "dataType": "text",
      "crossDomain": true
    }).done(function(data) {

      });

But it is not working because of the cross-domain restriction. When i set the datatype to "jsonp", it's also not working because the data will be interpreted and i get syntax errors.

Are there any workarounds? Thanks.

Upvotes: 0

Views: 943

Answers (1)

Gurpreet Singh
Gurpreet Singh

Reputation: 21233

You have following options:

  1. Use server side proxy
  2. JSONP, wrap csv into jsonp response
  3. Use CORS (check cross browser support)

Upvotes: 1

Related Questions