Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > AJAX
AJAX Forum sur la programmation AJAX. Avant de poster : Cours AJAX, FAQ AJAX, Toutes les FAQ JavaScript
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 30/12/2011, 01h24   #1
Nouveau Membre du Club
 
Phenix
Étudiant
Inscription : janvier 2008
Messages : 173
Détails du profil
Informations personnelles :
Nom : Phenix
Âge : 24

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : janvier 2008
Messages : 173
Points : 27
Points : 27
Par défaut Interaction entre fonction Ajax et page jsp

Bonjour
J'ai une variable integer que je passe d'une jsp à une fonction ajax pour la décrémenter jusqu'ici tout va bien, mais le problème c'est qu'une fois la variable modifiée dans la fonction Ajax j'arrive plus à la récupérer dans la jsp.
Voici l'appel à la fonction :

Code :
1
2
 
<a href="javascript:makeGetRequest(<%= op %>)"  style="width: 90px; position:absolute;top:380px;left:30px;">Précédent</a>

Voici la fonction Ajax:

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
 
<script language="Javascript" type="text/javascript">
<!--
 
function createRequestObject() {
    var tmpXmlHttpObject;
 
    //depending on what the browser supports, use the right way to create the XMLHttpRequest object
    if (window.XMLHttpRequest) { 
        // Mozilla, Safari would use this method ...
        tmpXmlHttpObject = new XMLHttpRequest();
 
    } else if (window.ActiveXObject) { 
        // IE would use this method ...
        tmpXmlHttpObject = new ActiveXObject("Microsoft.XMLHTTP");
    }
 
    return tmpXmlHttpObject;
}
 
//call the above function to create the XMLHttpRequest object
var http = createRequestObject();
 
function makeGetRequest(op) {
    //make a connection to the server ... specifying that you intend to make a GET request 
    //to the server. Specifiy the page name and the URL parameters to send
    	    alert("avoun"+op);
 
       op=op-3;
	    alert("apres"+op);
 
    //actually send the request to the server
    http.send(op);
}
 
function processResponse() {
    //check if the response has been received from the server
    if(http.readyState == 4){
 
        //read and assign the response from the server
        var response = http.responseText;
 
        //do additional parsing of the response, if needed
 
        //in this case simply assign the response to the contents of the <div> on the page. 
        document.getElementById('description').innerHTML = response;
 
        //If the server returned an error message like a 404 error, that message would be shown within the div tag!!. 
        //So it may be worth doing some basic error before setting the contents of the <div>
    }
}
 
-->
</script>
si quelqu'un peut m'aider je lui serai reconnaissant.
merci
phenix1988 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 08h22.


 
 
 
 
Partenaires

Hébergement Web