X
X
XenK2015-10-04 12:28:13
PHP
XenK, 2015-10-04 12:28:13

How to get URL via AJAX?

There is a link of the form:
http://site2.ru/?q=123&t=456
It must be passed to the PHP script via AJAX. The problem is that the link is truncated and becomes this: http://site2.ru/?q=123. How to transfer it completely, with all parameters?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Zubarev, 2015-10-04
@XenK

encodeURI to the rescue

I
Izzat Rakhmatov, 2015-10-04
@IzzatRakhmatov

$.ajax({
    url: 'http://www.example.org',
    data: {'a':1,'b':2,'c':3},
    dataType: 'xml',
    complete : function(){
        alert(this.url)
    },
    success: function(xml){
    }
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question