Reputation: 5
i created POST request, but its not working. When i 'Try it out!' in Swagger UI its works. So here is my script:
function myFunction() {
$.ajax
({
type: "POST",
url: 'localhost:8080/abc/abc',
dataType: 'json',
data: JSON.stringify({
"abc1": "abc",
"abc2": "[email protected]",
"abc3": "abc",
"abc4": "abc",
"abc5": "abc",
"abc6": "abc"
}),
contentType: 'application/json',
success: function () {
alert("Success!");
}
})};
Thanks for any suggestions.
Upvotes: 0
Views: 854
Reputation: 2244
When you make a post request, it looks the URL relative to your current path in the browser.
Try changing localhost:8080/abc/abc
to /abc/abc
.
Hope it helps.
Upvotes: 1