user6813858 user6813858 - 5 months ago 20
Ajax Question

How to appending url path in jquery


in jQuery Ajax
field gives the URL path but when i use a prefix in front of it like this:

type: 'GET'
url: 'api/'+ $(this).attr("href");

it doesn't work.

Whats going wrong? Is this wrong method or is there a better way?


$(this) -> will return a wrong result in the object.

Get the value in another place and add the ready result;

var getURL = 'api/'+ $(this).attr("href"); // In the level,where your $(this) is the actual this

    type: 'GET',
    url: getURL