1 | <script type="text/javascript"> |
---|
2 | var InterfaceInit = Class.create( { |
---|
3 | |
---|
4 | initialize: function() |
---|
5 | { |
---|
6 | /** *********** CONTAINERS *********** **/ |
---|
7 | this.containerForm = $( "#formulaire" ); |
---|
8 | |
---|
9 | this.createForm(); |
---|
10 | |
---|
11 | }, |
---|
12 | |
---|
13 | // CREATES ******************************************************** |
---|
14 | createForm: function() |
---|
15 | { |
---|
16 | // Create button elements |
---|
17 | this.input1 = $( document.createElement( "input" ) ); |
---|
18 | var input2 = $( document.createElement( "input" ) ); |
---|
19 | |
---|
20 | this.input1.attr( {id:"1"} ); |
---|
21 | this.containerForm.append( this.input1 ); |
---|
22 | |
---|
23 | input2.attr( {id:"2"} ); |
---|
24 | this.containerForm.append( input2 ); |
---|
25 | |
---|
26 | var submitButton = new Button( {value:initTexts["label.submitButton"], parent:this.containerForm, id:"button_submit", className: "red_button", classNameText:"red_button_text", onClick:jQuery.proxy( this.onClickSubmit, this )} ); |
---|
27 | |
---|
28 | }, |
---|
29 | |
---|
30 | |
---|
31 | // REQUESTS ******************************************************** |
---|
32 | requestCreateXML: function() |
---|
33 | { |
---|
34 | // alert(this.input1.val()+' - '+$("#2").val()); |
---|
35 | $.ajax( { |
---|
36 | url: "project?methodName=createUserRequest&input1="+this.input1.val()+"&input2="+$("#2").val(), |
---|
37 | success:jQuery.proxy( this.handleCreateXML, this ) |
---|
38 | } ); |
---|
39 | }, |
---|
40 | |
---|
41 | // HANDLES ******************************************************** = retours ajax |
---|
42 | handleCreateXML: function( result ) |
---|
43 | { |
---|
44 | // alert("XML créé"); |
---|
45 | var bob = jQuery.parseJSON( result ).result; |
---|
46 | alert(bob); |
---|
47 | |
---|
48 | }, |
---|
49 | |
---|
50 | |
---|
51 | // EVENTS ******************************************************** |
---|
52 | |
---|
53 | onClickSubmit: function() |
---|
54 | { |
---|
55 | this.requestCreateXML(); |
---|
56 | } |
---|
57 | |
---|
58 | |
---|
59 | } ); |
---|
60 | |
---|
61 | |
---|
62 | </script> |
---|