Reputation: 8420
The Curl of the API says that this is the correct format:
curl -X POST --header "Content-Type: application/json" --header "Accept: application/json" -d "2018062703,2018062703" "http://XX.XX.XX/api/my_url"
This API need parameters like this:
I'm trying to send them with this code:
var data = "2018062703,2018062703";
$.ajax({
type: 'POST',
data: data,
url: 'my/api/url',
dataType: 'json',
success: etc...
But I get a 404 not found. In the console of Chrome I got this:
What I'm doing wrong? In the web of the API when I put the parameters as a string "2018062703,2018062703" it works.
Upvotes: 0
Views: 454
Reputation: 3761
Your data
parameter in your AJAX call is invalid. It should look like this:
data: { filtro: data }
As it is now, you're trying to call your API with a parameter named
2018062703,2018062703
which has no value.
Upvotes: 2