Reputation: 1126
I am using ajax jquery to send data to php, as data I am sending one url as string from ajax that contains special character i.e "&" So I'm not getting full url i.e. my data it retrieved until '&' only rest id ignored and not displayed.
Below is my code for ajax and php:
dummytest.php
$temp=$_POST['address'];
echo $temp;
test.html (ajax to send data )
var send="http//192..../oracle/master.php?result=2&table=1"
$.ajax({
type: "POST",
url: "dummytest.php",
dataType: "text",
data: send,
success: onSuccess,
error: onError
});
I'm sending data "send" i.e one url as string data but I'm receiving it until "&" only in my php i.e.
http//192..../oracle/master.php?result=2
Can any one tell me how can I get my full data/url ?
Upvotes: 0
Views: 779
Reputation: 114
Use $(selector).serialize() method. The serialize() method creates a URL encoded text string by serializing form values.
Upvotes: 0
Reputation: 43198
You are sending the URL as the whole body of the POST request, while on the PHP side you are expecting to find it in the address
parameter. You should change send
on the Javascript side to
var send = { address: 'http://...' }
and jQuery will take care of encoding it in the body of the request.
Upvotes: 1