More

Failed to load resource: the server responded with a status of 400 (Bad Request)

Failed to load resource: the server responded with a status of 400 (Bad Request)


Am new to cartodb and am following this tutorial (http://docs.cartodb.com/tutorials/create_map_cartodbjs.html) on how to create a map.

When Implement the sql query, i get an error on the console saying "Failed to load resource: the server responded with a status of 400 (Bad Request)". I have included the screenshot of my browser displaying the error.

var subLayerOptions = { sql: "SELECT * FROM my_cartodb_table_title WHERE city = 'CITY X' " } cartodb.createLayer(map, layerUrl/*, {no_cdn: true}*/) .addTo(map) .done( function(layer) { layer.getSubLayer(0).set(subLayerOptions); data_layer = layer.getSubLayer(0); }) .error( function(err) { console.log("some error occurred: " + err); }); }

What could be the problem?


The request of your tiles is not being done correctly: check that the URLs you're showing includeundefinedas identifier.

This is probably caused by using CartoDB.js 3.11.23, which is a quite old version at the moment. The last version of 3.11 is 3.11.38 at this moment and it can be obtained with these URLs.

http://libs.cartocdn.com/cartodb.js/v3/3.11/themes/css/cartodb.css http://libs.cartocdn.com/cartodb.js/v3/3.11/cartodb.js

3.11 for HTTPS:

https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.11/themes/css/cartodb.css https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.11/cartodb.js

Right now, the last CartoDB.js release is version 3.15, whose URLs are the following ones:

http://libs.cartocdn.com/cartodb.js/v3/3.15/themes/css/cartodb.css

http://libs.cartocdn.com/cartodb.js/v3/3.15/cartodb.js

3.15 for HTTPS:

https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/themes/css/cartodb.css

https://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/3.15/cartodb.js

If you're using the non-versioned URL for CartoDB.js (http://libs.cartocdn.com/cartodb.js/v3/cartodb.js ), you need to be aware that this non-versioned URLs are deprecated and should be no longer used, but you need to specify the version you want in the URL.


Watch the video: Πόρος Πρωτοχρονιά 2021