Bosch HXR390H20T
-
Bosch HXR390H20T fırın Bosch'un 2019 yılı için çıkardığı özellikleri biraz
daha yükseltilmiş bir fırın görüntüsü veriyor. Seçimimizi bu fırından yana
kulla...
6 yıl önce
İçerikler özgün değildir. Sadece sık sık lazım olan işime yarayacak olan notları almış olduğum kişisel bloğumdur.
$_POST
' array in PHP.var http = new XMLHttpRequest();
var url = "get_data.php";
var params = "lorem=ipsum&name=binny";
http.open("GET", url+"?"+params, true);
http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4 && http.status == 200) {
alert(http.responseText);
}
}
http.send(null);
I really hope that this much is clear for you - I am assuming that you know a bit of Ajax coding. If you don't, please read a ajax tutorial that explains these parts before continuing.
var url = "get_data.php";
var params = "lorem=ipsum&name=binny";
http.open("POST", url, true);
//Send the proper header information along with the request
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");
http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4 && http.status == 200) {
alert(http.responseText);
}
}
http.send(params);
The first change(and the most obvious one) is that I changed the first argument of the open
function from GET to POST. Also notice the difference in the second
argument - in the GET method, we send the parameters along with the url
separated by a '?' character...http.open("GET",url+"?"+params, true);
But in the POST method we will use just the url as the second argument. We will send the parameters later.http.open("POST", url, true);
Some http headers must be set along with any POST request. So we set them in these lines...http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");
With the above lines we are basically saying that the data send is in
the format of a form submission. We also give the length of the
parameters we are sending.http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4 && http.status == 200) {
alert(http.responseText);
}
}
We set a handler for the 'ready state' change event. This is the same handler we used for the GET method. You can use the http.responseText
here - insert into a div using innerHTML(AHAH), eval it(JSON) or anything else.http.send(params);
Finally, we send the parameters with the request. The given url is
loaded only after this line is called. In the GET method, the parameter
will be a null value. But in the POST method, the data to be send will
be send as the argument of the send
function. The params
variable was declared in the second line as
"lorem=ipsum&name=binny" - so we send two parameters - 'lorem' and
'name' with the values 'ipsum' and 'binny' respectively.
jx.load("get_data.php?lorem=ipsum&name=binny",handlerFunction,"text","POST");
var myAjax = new Ajax.Request('get_data.php?lorem=ipsum&name=binny',{
method: 'post',
onComplete:handlerFunction
});
dojo.io.bind({
url: "get_data.php?lorem=ipsum&name=binny",
mimetype: "text/plain",
method: "POST",
load:handlerFunction
});
var myAjax = YAHOO.util.Connect.asyncRequest('POST', 'get_data.php?lorem=ipsum&name=binny', {success:handlerFunction},"");
var ajmyAjax = doSimpleXMLHttpRequest('get_data.php?lorem=ipsum&name=binny').addCallback(handlerFunction);
© Arif Erzin Bloğu-Kendime Notlar 2013 . Powered by Bootstrap , Blogger templates and RWD Testing Tool
Hiç yorum yok :
Yorum Gönder