How to send Ajax request to different url of same server

Dark Gomasu

I am sending an ajax request to my server like this :

 var data = '';

  $.ajax({
      type: 'GET',
      url: 'api/getnews/home/post/'+title,
      data: data,
      datatype: 'json',
      success: function (data) {
          var obj = JSON.parse(data)[0].fields;
          
          console.log(obj);
      }
      });

The url becomes

http://127.0.0.1:8000/home/post/api/getnews/home/post/title , if I am at http://127.0.0.1:8000/home/post

But , I want it to be :

http://127.0.0.1:8000/api/getnews/home/post/title

Any Suggestion..

Minh Viet

You can try url

window.location.origin + '/api/getnews/home/post/' + title

Or

'/api/getnews/home/post/' + title

like kusiaga

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to send Ajax request to different url of same server

From Dev

Ajax request to the same url

From Dev

How to create a jQuery-Ajax-Request but not send it right away to the server

From Dev

How to create a jQuery-Ajax-Request but not send it right away to the server

From Dev

How to send ajax request to server for updating user status "isOnline"

From Dev

how to make ajax call on same page ajax request send and get in same page

From Dev

Send AJAX Request and response with new URL

From Dev

Send AJAX Request and response with new URL

From Dev

Send Ajax request to Rails server in java

From Dev

Why there are different request headers for same ajax call?

From Dev

how to send two different types of JSON response for a same request based on the input REST?

From Dev

How do i implement a confirmation dialog/box before ajax request is send to server?

From Dev

How do i implement a confirmation dialog/box before ajax request is send to server?

From Dev

Transcrypt: How to send an ajax POST request to start a server side job using Python / Flask

From Dev

How to send form with ajax post request with rails

From Dev

How to send current page number in Ajax request

From Dev

How to send a token with an AJAX request from jQuery

From Dev

How to send an AJAX request for PHP form

From Dev

How to send Ajax request, using HttpClient

From Dev

How to send an Ajax request to Laravel 5.0 framework?

From Dev

How to send form with ajax post request with rails

From Dev

how to send ajax request via jQuery and Queue?

From Dev

How to send a cross domain ajax request

From Dev

How to send a POST Request withou ajax

From Dev

$_SESSION PHP is not recognized on the same server in different URL

From Dev

AJAX GET request to a different URL appends original URL with GET query

From Dev

How to send permanently a request to my http server

From Dev

How to send JSON Format HTTP Request to Server?

From Dev

How to send a request to the server and get the data

Related Related

  1. 1

    How to send Ajax request to different url of same server

  2. 2

    Ajax request to the same url

  3. 3

    How to create a jQuery-Ajax-Request but not send it right away to the server

  4. 4

    How to create a jQuery-Ajax-Request but not send it right away to the server

  5. 5

    How to send ajax request to server for updating user status "isOnline"

  6. 6

    how to make ajax call on same page ajax request send and get in same page

  7. 7

    Send AJAX Request and response with new URL

  8. 8

    Send AJAX Request and response with new URL

  9. 9

    Send Ajax request to Rails server in java

  10. 10

    Why there are different request headers for same ajax call?

  11. 11

    how to send two different types of JSON response for a same request based on the input REST?

  12. 12

    How do i implement a confirmation dialog/box before ajax request is send to server?

  13. 13

    How do i implement a confirmation dialog/box before ajax request is send to server?

  14. 14

    Transcrypt: How to send an ajax POST request to start a server side job using Python / Flask

  15. 15

    How to send form with ajax post request with rails

  16. 16

    How to send current page number in Ajax request

  17. 17

    How to send a token with an AJAX request from jQuery

  18. 18

    How to send an AJAX request for PHP form

  19. 19

    How to send Ajax request, using HttpClient

  20. 20

    How to send an Ajax request to Laravel 5.0 framework?

  21. 21

    How to send form with ajax post request with rails

  22. 22

    how to send ajax request via jQuery and Queue?

  23. 23

    How to send a cross domain ajax request

  24. 24

    How to send a POST Request withou ajax

  25. 25

    $_SESSION PHP is not recognized on the same server in different URL

  26. 26

    AJAX GET request to a different URL appends original URL with GET query

  27. 27

    How to send permanently a request to my http server

  28. 28

    How to send JSON Format HTTP Request to Server?

  29. 29

    How to send a request to the server and get the data

HotTag

Archive