I have this weird situation where my form doesn't send any data, but the page (which should only be displayed when the data is send) is shown.
I have this code now:
[..]
if(form == true){
var gender = $("input[@name='rgender']:checked").val();
var data = "name="+$("#name").val()+"&gender="+gender+"&country="+$("#country").val()+"&address="+$("#address").val开发者_JAVA技巧()+"&zip="+$("#zip").val()+"&city="+$("#city").val()+"&mail="+$("#mail").val()+"&phone="+$("#phone").val()+"&checkin="+$("#checkin").val()+"&guests="+$("#guests").val()+"&time="+$("#time").val()+"&nights="+$("#nights").val()+"&remarks="+$("#remarks").val();
$.ajax({
url: "http://www.domain.nl/tmp/process.php",
type: "GET",
data: data,
cache: false,
success: function(){
$("#content").empty();
$("#content").load('http://www.domain.nl/tmp/process.php');
}
});
f.preventDefault();
}
[..]
I checked the data string with an alert()
before and that one is working well
My php file looks like this, but I don't get any values
<?php
echo("GET: ".$_GET['name']);
?
>
maybe this will help:
success: function(result){
$("#content").html(result);
}
In your code you are sending 2 ajax request. First with $.ajax and with some GET parameters, and second with $().load, but without any parameters. So actually you can simplify your code to this:
if(form == true){
var gender = $("input[@name='rgender']:checked").val();
var data = "name="+$("#name").val()+"&gender="+gender+"&country="+$("#country").val()+"&address="+$("#address").val()+"&zip="+$("#zip").val()+"&city="+$("#city").val()+"&mail="+$("#mail").val()+"&phone="+$("#phone").val()+"&checkin="+$("#checkin").val()+"&guests="+$("#guests").val()+"&time="+$("#time").val()+"&nights="+$("#nights").val()+"&remarks="+$("#remarks").val();
$("#content").load('http://www.cherrytrees.nl/tmp/process.php', data);
f.preventDefault();
}
Change it as follows:
url: "http://www.cherrytrees.nl/tmp/process.php?" + data,
In your original request you were sending it via POST, rather than GET.
url: "http://www.cherrytrees.nl/tmp/process.php",
type: "GET",
data: data,
the option "data" ist only for POST type, if you wont to GET paratmeeters, write them in your URL
url.com?name="+$("#name").val()+"&gende....
精彩评论