no save
Assistance
Achat
News

Forum | webmastering
[Ajax] Appel d'une méthode PHP via Ajax ?
monsieur propre, le mer. 31 janv. 2007 à 10:43:58
Dans ce cas, tu peux utiliser une page php qui sera la porte d'entrée :

interprete.php

Avec un switch sur la fonction à appeler :

$fonction = $_POST['fonction'];
switch($fonction)
{
case('addition')
// ma fonction
break;
default:
break;
}

Et dans tes pages HTML ou tes fonctions javascript, tu fais un appel comme ujn lien classique :

<a href="interprete.php?fonction=additionne">mon lien</a>

ou

function go()
{
var xhr = getXhr()
xhr.open("POST","interprete.php",true);
xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xhr.send("fonction=additionne");
}
PrécédentSethpolma
janv. 07
Faust
26 sept.
Suivant
REPONSES
kij_82
janv. 07
Sethpolma
janv. 07
monsieur propre
janv. 07
Faust
26 sept.
Version Web
Réalisé par RedShift
no save