![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 63 Pomógł: 0 Dołączył: 16.04.2006 Ostrzeżenie: (0%) ![]() ![]() |
Witam...
Jak zrobić by można było posługiwać się funkcjami napisanymi w php w kodzie js, tak jak jest to zrobione m.in. w xAjax? Pozdrawiam. |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 7 Pomógł: 0 Dołączył: 19.09.2007 Ostrzeżenie: (0%) ![]() ![]() |
Masz tu prosty przykład
CODE function createRequestObject() { var ro; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ ro = new ActiveXObject("Microsoft.XMLHTTP"); }else{ ro = new XMLHttpRequest(); } return ro; } var http = createRequestObject(); function f_sndReq(action) { http.open('POST', 'skrypt.php?szukaj='+action); http.onreadystatechange = handleResponse; http.send(null); } function f_hide(id){ document.getElementById(id).innerHTML = ""; // static } function handleResponse() { if(http.readyState == 4){ var response = http.responseText; // window.status="Proszę czekać..."; f_operacja(response); // alert(response); // document.getElementById('szukaj').value = response; // document.getElementById('wd').innerHTML=response; } } A potem masz inputa, który wywoluje AJAX <input type="button" id="i_inp" value="Wyślij zapytanie" style="border:1px #000000 solid; font:10px; color:#000000; width:145px; height:25px; background-color:#e9f0f7;cursor:pointer; cursor:hand;" onclick="java script: f_sndReq(getElementById('szukaj').value);f_hide('i_wd');"> Ten post edytował callou 20.09.2007, 12:21:04 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 4.10.2025 - 00:06 |