just a quick question :
var h = $('#hebergeurJQUERY').val();
var t = $('#typeJQUERY').val();
function requestData() {
$.ajax({
type: "GET",
url: '12months/months.php',
data : "hosting="+h+"&type="+t+"",
.开发者_JAVA百科.....
doesnt work while
data : "hosting=Something&type=Something",
Works.
Any idea to something stupid i did (again ?) ;)
Thanks
If you pass an object to the data parameter, then jQuery handles all the escaping for you which may be a cause of the problem. You might also have hit problems because of the actual timing of the execution of the code. Put the definition into the function itself:
function requestData() {
$.ajax({
type : 'GET',
url : 'months.php',
data : {
hosting : $('#hebergeurJQUERY').val(),
type : $('#typeJQUERY').val()
}
...
});
}
I'd change the data
key assignment to:
data: {
hosting: h,
type: t
}
Doing so will cause jQuery to generate the URL-encoded string that I think you were trying to generate here.
精彩评论