Jump to content
php.lv forumi

Php + Ajax


hoho

Recommended Posts

hmm...nu kaut ko es pielaboju. tagad es izsaucu funkciju:

xmlHttp=GetXmlHttpObject()

if (xmlHttp==null)

{

return false;

}

var url = "/abonesana/ajax2.php";

var params = "doo=yes";

xmlHttp.open("POST", url, true);

xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

xmlHttp.setRequestHeader("Content-length", params.length);

xmlHttp.setRequestHeader("Connection", "close");

 

xmlHttp.onreadystatechange=updatePr3 ;

xmlHttp.send(params);

tad paaraadas jaunie formas lauki. bet peec submiteesanas es nesanjemu datus. kur ir probleema?

Link to comment
Share on other sites

Nu tas bija tikai piemeers, es nosuutu doo=yes, tad ta funkcija atgriez html

un peec tam pamatformaa document.getElementById("testId").innerHTML=xmlHttp.responseText , tika pievienots tas HTMl -> jaunie lauki. Bet tam es taisu submitu, bet datus no tiem laukiem nesanjemu.

Link to comment
Share on other sites

ustaisi testiem mazinju JS funkciju

 

function bla(id)

{

var xxxdocument.getElementById(id).value;

alert(xxx);

}

 

un kautkur noliec linku

<a href"java script:void(0)" onclick="bla('testejamais_id')" > test</a>

un taad patestee vai vispar tiec tam laukam klat, vai pareizss id (name) utt...

Link to comment
Share on other sites

×
×
  • Create New...