Tell me, the link shortening service made the following function: http://sulx.ru/shortme/api/apikey=0&url=https://developers.google.com/url-shortener/v1/getting_started
How to pull a link from there?
|
2 answers
But it is not easier to do this in the form of an AJAX request and receive this link in response as a JSON. {"shortUrl": "http://sulx.ru/0fa2af6b"}
$.ajax({ url: "http://sulx.ru/shortme/api/", method: 'POST', data: {apikey: 0, url: "https://developers.google.com/url-shortener/v1/getting_started"} }).done(function(data){ console.log(data.shortUrl); }).fail(function(dataError){ console.log(dataError); });
- Displays an error with such a request - Yuri
- I have no idea what language your backend is and not only what error? - Shnur
- It does not understand what
shortUrl
! - Yuri - You send the object in response or just the same as it was? - Shnur
|
document.body.innerHTML will give you back text from the body
|