AKB Forums

Go Back   AKB Forums > Technical sections > Languages, Compilers and Interpreters > Web Development
Home Register Blogs FAQ Members List Calendar Downloads Arcade Mark Forums Read

Web Development Java/PHP/Perl/ASP and more

Troubles when posting message? Click here! :: Проблемы с отправлением сообщения? Нажмите сюда!

Reply
 
LinkBack Thread Tools Display Modes
Old Feb 23, 2007, 15:04  
Stalker
 
Timewind's Avatar
 
Join Date: Sep 2002
Location: Припять
Posts: 838
Rep Power: 6
Reputation: 10
Send a message via ICQ to Timewind Send a message via Skype™ to Timewind
Question: PHP->JS var transfer (with AJAX)

кто поможет с AJAXом??

<script>
... some ajax JS code ...

function auau(query) {

http.open("POST", "other.php", true);
http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
http.onreadystatechange = handleResponse;
http.send(query);
}

function kuku () {
if(http.readyState == 4){
var response = http.responseText;
}
}

</script>

<select id="ay_di" name="sel" multiple></select>

и так:

response в функции kuku, возвращает ЧТО ТО из other.php.
что за ЧТО ТО мне нужно возвратить в Javascript чтоб это оказалось OPTIONами в Select "sel" ??
__________________
... for long you live and high you fly ...
Timewind is offline   Reply With Quote Quote selected
Old Feb 25, 2007, 08:33   #16
Авик
 
CyberJoe's Avatar
 
Join Date: Jul 2002
Location: Yerevan
Posts: 1,347
Rep Power: 7
Reputation: 19
Send a message via ICQ to CyberJoe
Де эт менаик ИЕ-и так иск гареджуры Мултибраузерутян вров сахманапакум чунер, мрутег
Иск ИЕ-и так асеци дзевы сути чипохвум мека.
__________________
вот собственно все, что я хотел сказать.
CyberJoe is offline   Reply With Quote Quote selected
Old Feb 25, 2007, 13:16   #17
скромный VIP
 
analyst's Avatar
 
Join Date: Jun 2003
Location: Yerevan
Posts: 959
Rep Power: 6
Reputation: 10
А я вот JSON использую - и рад.

прелести:
1. ответ сервера в принципе парсить особо не нужно - можно обойтись банальным eval - ом(если сикюрити не важен особо, a а если важен - то есть и парсилки).
2. легко читаем во время дебага (как никак читать родную джаваскрипт структуру приятней, чем ХМЛ читать.)
3. Да и со стороны сервера ответы собирать в ней легко и приятно.

Весчь. Советую. json.org
__________________
И аткуда такие беруцца???
analyst is offline   Reply With Quote Quote selected
Old Feb 26, 2007, 05:43   #18
Stalker
 
Timewind's Avatar
 
Join Date: Sep 2002
Location: Припять
Posts: 838
Rep Power: 6
Reputation: 10
Send a message via ICQ to Timewind Send a message via Skype™ to Timewind
буду краток
minchev post anel@ vorosh rezul`tatneri hasel em:
1. innerHTML menak vercnum a ajax-ic eval-ov.
2. innerHTML IEum SELECTi hamar chi ashxtum when getelementbyid

3. hesa mi hat el nayem el incher eq arajarkel, kasem vonc ashxatec

thanx anyway guys
__________________
... for long you live and high you fly ...
Timewind is offline   Reply With Quote Quote selected
Old Feb 26, 2007, 06:44   #19
*****
 
Michael's Avatar
 
Join Date: Mar 2003
Location: Yerevan
Posts: 310
Rep Power: 6
Reputation: 14
Send a message via ICQ to Michael
JSON-ov datan vertcneluc & hesht e & tetev & harmar

isk vor select@ chi ashxatum etentc el piti lini

innerHTML ov du ugaki nerdnum es HTML -i mej text
qez petq e
document.createElement
ogtagortcel
__________________
Men's eyes were made to look, and let them gaze.
Michael is offline   Reply With Quote Quote selected
Old Feb 26, 2007, 13:56   #20
User
 
ByTheWay's Avatar
 
Join Date: Jul 2006
Location: Yerevan
Posts: 880
Rep Power: 3
Reputation: 33
<html>
<head>
<title>Ajax and PHP at work</title>
<script language = “javascript”>
var XMLHttpRequestObject = false;
if (window.XMLHttpRequest) {
XMLHttpRequestObject = new XMLHttpRequest();
} else if (window.ActiveXObject) {
XMLHttpRequestObject = new ActiveXObject(“Microsoft.XMLHTTP”);
}
function getData(dataSource, divID)
{
if(XMLHttpRequestObject) {
var obj = document.getElementById(divID);
XMLHttpRequestObject.open(“GET”, dataSource);
XMLHttpRequestObject.onreadystatechange = function()
{
if (XMLHttpRequestObject.readyState == 4 &&
XMLHttpRequestObject.status == 200) {
obj.innerHTML = XMLHttpRequestObject.responseText;
}
}
XMLHttpRequestObject.send(null);
}
}
</script>
</head>
<body>
<H1>Fetching data with Ajax and PHP</H1>
<form>
<input type = “button” value = “Display Message”
onclick = “getData(data.php’, ‘targetDiv’)”>
</form>
<div id=”targetDiv”>
<p>The fetched data will go here.</p>
</div>
</body>
</html>
__________________
stop your eyes from flowing out
ByTheWay is offline   Reply With Quote Quote selected
Old Feb 26, 2007, 14:17   #21
Дошкольник
 
Join Date: Oct 2004
Location: Yerevan
Posts: 116
Rep Power: 4
Reputation: 12
Send a message via ICQ to Intel
Quote:
Originally Posted by Obelix View Post
Av pravilniy kod tot kotoriy kross platformen. s innerhtml bivayet mnogo problem, konkret im orinakum - selectboxi het, karcem ff um chashxatec. et vaxt araji angam imaca dom objecte vorna

amachelu vrov. <br> maqur html a, bayc xml chi. Amachecir ? )
Voobshe, select-i API-n shat teri a, orinak nuyn optgrouperi momentov:
Asenk uzum es Optgroup-in element avelacnes, eti mi ayl dzevi gemaroy ban a.
Intel is offline   Reply With Quote Quote selected
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
XML parsing in PHP question. Timewind Web Development 1 Mar 5, 2005 10:01
PHP against ASP acid Web Development 1 Aug 6, 2004 21:30
another php question hov Web Development 9 Nov 5, 2002 04:05
php question hov Web Development 2 Oct 14, 2002 20:03
PHP remote vulnerabilities VX Software Security 0 Mar 4, 2002 19:20


All times are GMT. The time now is 13:37.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
This board was founded on September 29, 2001
Powered by Viper Internet

Affordable Web Hosting | ParevNet

Buy text link