Answer the question
In order to leave comments, you need to log in
$.ajax via GET not working on all versions of Internet Explorer?
Friends help me with this problem.
There is a code on the client side
That is, I pass the GET str parameter via AJAX
var str = 'тест';
$.ajax({
url: 'http://' + window.location.host + '/search/test',
type : 'GET',
data: 'str=' + str,
dataType: "json",
success: function(res){
console.log(res);
}
});
class Search extends MY_Controller {
public function test()
{
echo json_encode($_GET);
}
}
var str = 'тест';
$.ajax({
url: 'http://' + window.location.host + '/search/test',
type : 'POST',
data: 'str=' + str,
dataType: "json",
success: function(res){
console.log(res);
}
});
class Search extends MY_Controller {
public function test()
{
echo json_encode($_POST);
}
}
Answer the question
In order to leave comments, you need to log in
And if you just try
var str = 'тест';
$.ajax({
url: 'http://' + window.location.host + '/search/test?str='+encodeURIComponent(str),
type : 'GET',
dataType: "json",
success: function(res){
console.log(res);
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question