Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2012
    Posts
    24
    Thanks
    6
    Thanked 0 Times in 0 Posts

    need help with Ajax, jQuery, PHP MVC Pattern

    I'm trying to separate my code with the MVC pattern using AJAX, PHP, and JS
    Let's jump right in ... ( I have been trying hours and researched all over the net until i got annoyed and decided to ask for help )


    login.html

    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Login Page</title>
    
      <LINK rel="stylesheet" type="text/css" href="/coupons/css/style.css">
    	<script src="/coupons/js/controllerJS.js" type="text/javascript"></script>
    	<script src="/coupons/js/valider.js" type="text/javascript"></script>
    
      <style>
    	a {
            border: 1px solid green;}
    	</style>
    	
    </head>
    <body >
    
    <div id="divLogin">
    <h1>Login Page</h1>
    <h2>Please Fill in the following form</h2>
    
    
     <form ENCTYPE="multipart/form-data" name="fLogin" id="fLogin" action="" method="POST">
           <table id="tForm" border="1">
    	   <tr>
           	<td><label for="email">Email Address</label></td>
            <td> <input type="text" autocomplete="off" tabindex="1" class="txtfield" id="email" name="email"></td>
            </tr>
            
           <tr>    
               <td><label for="password">Password</label></td>
                <td><input type="password" autocomplete="off" tabindex="2" class="txtfield" id="password" name="password"></td>
                </tr>
                <tr>
                <td> <input type="submit" class="btn" id="btnSub"></td></tr>
    			</table>
    </form>
              
           
    </div>
    </body>
    </html>
    So now back to the JS file which will act as controller AJAX
    controllerJS,js

    Code:
    $(function(){
    	
    	$('#fLogin').submit(function(event){
    	// On desactive le comportement par default du navigateur
    	// qui consiste a appeller la page action du formulaire
    	alert("form had been submitted for review");
    	event.preventDefault();
    	var data = "email="+$('#email').val()+"&password="+$('#password').val()+"&action=X";
    	alert(data);
    	$.ajax({
    	type: "POST",
    	url: "bin/controller/controller.php",
    	data: data,
    	success: function(data, statusText, jqXHR) {
        alert(jqXHR.responseText);
    	var xmlDoc=jqXHR.responseXML;
    	$('#login').html(xmlDoc.getElementsByTagName("membre")[0].firstChild.nextSibling.firstChild.nodeValue)
    	.hide()
    	.fadeIn(3500).animate({right:'400px', top:'20px'}, 3500).css({"color":"red","font-size":"25px"}); 
    	}
    });
    
    return false;           // Prevents browser from loading a new page
    });
    
    
    
    });
    Now the PHP File
    controller.php


    PHP Code:
    <?php

    session_start
    ();
    require(
    "../../paramDB/connexion.php");


    $table="membre";
    // Fonction dans le controlleur envoie le message sous forme XML a la Vue

    function listeXML($req){
     
    header ("Content-Type: text/xml");
            echo 
    "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
            echo 
    "<xml>";
            while (
    $row mysql_fetch_assoc($req))
            {
                echo 
    "<membre>";
                echo 
    "<userID>$row[userID]</userID>";
                echo 
    "<username>$row[username]</username>";
                echo 
    "<password>$row[pass]</password>";
                echo 
    "<AccountType>$row[aType]</AccountType>";
                echo 
    "</membre>";
            }
            echo 
    "</xml>"
    }

    $action=$_POST['action'];
    switch(
    $action){




    case 
    "X" :    
            
            
    mysql_select_db($sql_bdd,$db_link);
            
    $requete="SELECT * FROM $table";
            
    $req=mysql_query($requete,$db_link) or die(mysql_error());
            
    listeXML($req);
            break; 
            


                    
    }
    ?>
    This form works properly... but it doesn't validate ...
    So where is my problem ? Please continue ... as I explain ...
    I'm trying to have another form validate and go though the same file
    controllerJS.js

    Now this form validates but nothing hapens and i'm lost after having tring so many different things.

    Code:
    <head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>
    
    	<script src="/coupons/js/controllerJS.js" type="text/javascript"></script>
    	<script src="/coupons/js/valider.js" type="text/javascript"></script>
    
    
    <style>
    
    .valid{
    	border: #0C3 solid 3px;
    	}
    .invalid{
    	border:#C00 solid 3px;
    	}
    
    div#formReg td>input {
    	line-height: 1em;
    	width: 280px;
    }
    
    h1 {
    	text-align: center;
    	margin: 0px;
    
    }
    div#formReg{
    position: relative;
    margin : 20px 100px; 0 0;
    
    }
    
    div#formReg td label{
    background-color:#FFFF66;
    		margin:8px;
    		width:140px;
    
    }
    </style>
    
    </head><div id="content" >
          
          <!-- CONTENT -->
          <div id="formReg">
    	  <h1>Creation de compte utilisateur</h1>
            <form ENCTYPE="multipart/form-data" id="ajouterform" name="ajouterform"  action="" method="post">
              <table>
                <tr >
                  <td class='titre' colspan = '2'></td>
                  <td class="Valogo">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <img src="" name="exit_button" width="20px" height="20px" ></td>
                </tr>
                <tr>
                  <td ><label for="userN">Nom Usager :</label></td>
                  <td ><input class="txtField" name="userN" type="text" id="userN" ></td>
                  <td><img src="" id="i1" width="20px" height="20px" ></td>
                    </td>
                </tr>
                <tr>
                  <td ><label for="pass">Mot de passe :</label></td>
                  <td><input class="txtField" name="pass" type="password" id="pass"></td>
                    <td><img src="" id="i2" width="20px" height="20px" ></td>
                </tr>
                <tr>
                  <td><label for="cpass">Comfirmation  :</label></td>
                  <td><input class="txtField" name="cpass" type="password" id="cpass"></td>
                    <td><img src="" id="i3" width="20px" height="20px" ></td>
                </tr>
                <tr height ="20">
                  <td style="border:none">
                </tr>
                <tr>
                  <td><label for="nom"> Nom :</label></td>
                  <td><input class="txtField" name="nom" type="text" id="nom"></td>
                    <td><img src="" id="i4" width="20px" height="20px" ></td>
                </tr>
                <tr>
                  <td ><label for="prenom">Prenom :</label> </td>
                  <td><input class="txtField" name="prenom" type="text" id="prenom"></td>
                    <td><img src="" id="i5" width="20px" height="20px" ></td>
                </tr>
                <tr>
                  <td><label for="tel" > Téléphone  #: </label></td>
                  <td><input class="txtField" name="tel" type="text" id="tel"></td>
                    <td><img src="" id="i6" width="20px" height="20px" ></td>
                </tr>
                <tr>
                  <td><label for="adresse"> Adresse : </label></td>
                  <td><input class="txtField" name="adresse" type="text" id="adresse"></td>
                    <td><img src="" id="i7" width="20px" height="20px" ></td>
                </tr>
                <tr>
                  <td ><label for="ville"> Ville : </label></td>
                  <td><input  class="txtField" name="ville" type="text" id="ville"></td>
                    <td><img src="" id="i8" width="20px" height="20px" ></td>
                </tr>
                <tr>
                  <td ><label for="prov"> Province : </label></td>
                  <td><input class="txtField" name="prov" type="text" id="prov"></td>
                    <td><img src="" id="i9" width="20px" height="20px" ></td>
                </tr>
                <tr>
                  <td ><label for="country"> Pays : </label></td>
                  <td><select class="txtField" id="country" name="country">
                      <option value=""   SELECTED>Select One</option>
                      <option value="af"   >Afghanistan</option>
                      <option value="ax"   >Aland Islands</option>
                      <option value="al"   >Albania</option>
                      <option value="dz"   >Algeria</option>
                      <option value="as"   >American Samoa</option>
                      <option value="ad"   >Andorra</option>
                      <option value="ao"   >Angola</option>
                      <option value="ai"   >Anguilla</option>
                      <option value="aq"   >Antarctica</option>
    ...Have to cut the post in 2 as i go over 20000 caracters code will folow in post number 2
    Last edited by hayonj; 11-01-2012 at 03:35 PM. Reason: add code end tag

  • #2
    New Coder
    Join Date
    Apr 2012
    Posts
    24
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Code:
                      <option value="ag"   >Antigua and Barbuda</option>
                      <option value="ar"   >Argentina</option>
                      <option value="am"   >Armenia</option>
                      <option value="aw"   >Aruba</option>
                      <option value="au"   >Australia</option>
                      <option value="at"   >Austria</option>
                      <option value="az"   >Azerbaijan</option>
                      <option value="bs"   >Bahamas</option>
                      <option value="bh"   >Bahrain</option>
                      <option value="bd"   >Bangladesh</option>
                      <option value="bb"   >Barbados</option>
                      <option value="by"   >Belarus</option>
                      <option value="be"   >Belgium</option>
                      <option value="bz"   >Belize</option>
                      <option value="bj"   >Benin</option>
                      <option value="bm"   >Bermuda</option>
                      <option value="bt"   >Bhutan</option>
                      <option value="bo"   >Bolivia</option>
                      <option value="ba"   >Bosnia and Herzegovina</option>
                      <option value="bw"   >Botswana</option>
                      <option value="bv"   >Bouvet Island</option>
                      <option value="br"   >Brazil</option>
                      <option value="io"   >British Indian Ocean Territory</option>
                      <option value="vg"   >British Virgin Islands</option>
                      <option value="bn"   >Brunei</option>
                      <option value="bg"   >Bulgaria</option>
                      <option value="bf"   >Burkina Faso</option>
                      <option value="bi"   >Burundi</option>
                      <option value="kh"   >Cambodia</option>
                      <option value="cm"   >Cameroon</option>
                      <option value="ca"   >Canada</option>
                      <option value="cv"   >Cape Verde</option>
                      <option value="ky"   >Cayman Islands</option>
                      <option value="cf"   >Central African Republic</option>
                      <option value="td"   >Chad</option>
                      <option value="cl"   >Chile</option>
                      <option value="cn"   >China</option>
                      <option value="cx"   >Christmas Island</option>
                      <option value="cc"   >Cocos (Keeling) Islands</option>
                      <option value="co"   >Colombia</option>
                      <option value="km"   >Comoros</option>
                      <option value="cg"   >Congo</option>
                      <option value="gd"   >Grenada</option>
                      <option value="gp"   >Guadeloupe</option>
                      <option value="gu"   >Guam</option>
                      <option value="gt"   >Guatemala</option>
                      <option value="gn"   >Guinea</option>
                      <option value="gw"   >Guinea-Bissau</option>
                      <option value="gy"   >Guyana</option>
                      <option value="ht"   >Haiti</option>
                      <option value="hm"   >Heard Island and Mcdonald Islands</option>
                      <option value="hn"   >Honduras</option>
                      <option value="hk"   >Hong Kong</option>
                      <option value="hu"   >Hungary</option>
                      <option value="is"   >Iceland</option>
                      <option value="in"   >India</option>
                      <option value="id"   >Indonesia</option>
                      <option value="ir"   >Iran</option>
                      <option value="iq"   >Iraq</option>
                      <option value="xe"   >Iraq-Saudi Arabia Neutral Zone</option>
                      <option value="ie"   >Ireland</option>
                      <option value="il"   >Israel</option>
                      <option value="it"   >Italy</option>
                      <option value="ci"   >Ivory Coast</option>
                      <option value="jm"   >Jamaica</option>
                      <option value="jp"   >Japan</option>
                      <option value="jo"   >Jordan</option>
                      <option value="kz"   >Kazakhstan</option>
                      <option value="ke"   >Kenya</option>
                      <option value="ki"   >Kiribati</option>
                      <option value="kw"   >Kuwait</option>
                      <option value="kg"   >Kyrgyzstan</option>
                      <option value="la"   >Laos</option>
                      <option value="lv"   >Latvia</option>
                      <option value="lb"   >Lebanon</option>
                      <option value="ls"   >Lesotho</option>
                      <option value="lr"   >Liberia</option>
                      <option value="ly"   >Libya</option>
                      <option value="li"   >Liechtenstein</option>
                      <option value="lt"   >Lithuania</option>
                      <option value="lu"   >Luxembourg</option>
                      <option value="mo"   >Macau</option>
                      <option value="mk"   >Macedonia</option>
                      <option value="mg"   >Madagascar</option>
                      <option value="mw"   >Malawi</option>
                      <option value="my"   >Malaysia</option>
                      <option value="mv"   >Maldives</option>
                      <option value="ml"   >Mali</option>
                      <option value="mt"   >Malta</option>
                      <option value="mh"   >Marshall Islands</option>
                      <option value="mq"   >Martinique</option>
                      <option value="mr"   >Mauritania</option>
                      <option value="mu"   >Mauritius</option>
                      <option value="yt"   >Mayotte</option>
                      <option value="mx"   >Mexico</option>
                      <option value="md"   >Moldova</option>
                      <option value="mc"   >Monaco</option>
                      <option value="mn"   >Mongolia</option>
                      <option value="ms"   >Montserrat</option>
                      <option value="ma"   >Morocco</option>
                      <option value="mz"   >Mozambique</option>
                      <option value="mm"   >Myanmar</option>
                      <option value="na"   >Namibia</option>
                      <option value="nr"   >Nauru</option>
                      <option value="np"   >Nepal</option>
                      <option value="nl"   >Netherlands</option>
                      <option value="an"   >Netherlands Antilles</option>
                      <option value="nc"   >New Caledonia</option>
                      <option value="nz"   >New Zealand</option>
                      <option value="ni"   >Nicaragua</option>
                      <option value="ne"   >Niger</option>
                      <option value="ng"   >Nigeria</option>
                      <option value="nu"   >Niue</option>
                      <option value="nf"   >Norfolk Island</option>
                      <option value="kp"   >North Korea</option>
                      <option value="mp"   >Northern Mariana Islands</option>
                      <option value="no"   >Norway</option>
                      <option value="om"   >Oman</option>
                      <option value="pk"   >Pakistan</option>
                      <option value="pw"   >Palau</option>
                      <option value="ps"   >Palestinian Territories</option>
                      <option value="pa"   >Panama</option>
                      <option value="pg"   >Papua New Guinea</option>
                      <option value="py"   >Paraguay</option>
                      <option value="pe"   >Peru</option>
                      <option value="ph"   >Philippines</option>
                      <option value="pn"   >Pitcairn Islands</option>
                      <option value="pl"   >Poland</option>
                      <option value="pt"   >Portugal</option>
                      <option value="pr"   >Puerto Rico</option>
                      <option value="qa"   >Qatar</option>
                      <option value="re"   >Reunion</option>
                      <option value="ro"   >Romania</option>
                      <option value="ru"   >Russia</option>
                      <option value="rw"   >Rwanda</option>
                      <option value="sh"   >Saint Helena and Dependencies</option>
                      <option value="kn"   >Saint Kitts and Nevis</option>
                      <option value="lc"   >Saint Lucia</option>
                      <option value="pm"   >Saint Pierre and Miquelon</option>
                      <option value="vc"   >Saint Vincent and the Grenadines</option>
                      <option value="ws"   >Samoa</option>
                      <option value="sm"   >San Marino</option>
                      <option value="st"   >Sao Tome and Principe</option>
                      <option value="sa"   >Saudi Arabia</option>
                      <option value="sn"   >Senegal</option>
                      <option value="sc"   >Seychelles</option>
                      <option value="sl"   >Sierra Leone</option>
                      <option value="sg"   >Singapore</option>
                      <option value="sk"   >Slovakia</option>
                      <option value="si"   >Slovenia</option>
                      <option value="sb"   >Solomon Islands</option>
                      <option value="so"   >Somalia</option>
                      <option value="za"   >South Africa</option>
                      <option value="gs"   >South Georgia and South Sandwich Islands</option>
                      <option value="kr"   >South Korea</option>
                      <option value="es"   >Spain</option>
                      <option value="pi"   >Spratly Islands</option>
                      <option value="lk"   >Sri Lanka</option>
                      <option value="sd"   >Sudan</option>
                      <option value="sr"   >Suriname</option>
                      <option value="sj"   >Svalbard and Jan Mayen</option>
                      <option value="sz"   >Swaziland</option>
                      <option value="se"   >Sweden</option>
                      <option value="ch"   >Switzerland</option>
                      <option value="sy"   >Syria</option>
                      <option value="tw"   >Taiwan</option>
                      <option value="tj"   >Tajikistan</option>
                      <option value="tz"   >Tanzania</option>
                      <option value="th"   >Thailand</option>
                      <option value="tg"   >Togo</option>
                      <option value="tk"   >Tokelau</option>
                      <option value="to"   >Tonga</option>
                      <option value="tt"   >Trinidad and Tobago</option>
                      <option value="tn"   >Tunisia</option>
                      <option value="tr"   >Turkey</option>
                      <option value="tm"   >Turkmenistan</option>
                      <option value="tc"   >Turks And Caicos Islands</option>
                      <option value="tv"   >Tuvalu</option>
                      <option value="ug"   >Uganda</option>
                      <option value="ua"   >Ukraine</option>
                      <option value="ae"   >United Arab Emirates</option>
                      <option value="uk"   >United Kingdom</option>
                      <option value="us"   >United States</option>
                      <option value="um"   >United States Minor Outlying Islands</option>
                      <option value="uy"   >Uruguay</option>
                      <option value="vi"   >US Virgin Islands</option>
                      <option value="uz"   >Uzbekistan</option>
                      <option value="vu"   >Vanuatu</option>
                      <option value="va"   >Vatican City</option>
                      <option value="ve"   >Venezuela</option>
                      <option value="vn"   >Vietnam</option>
                      <option value="wf"   >Wallis and Futuna</option>
                      <option value="eh"   >Western Sahara</option>
                      <option value="ye"	 >Yemen</option>
                      <option value="zm"   >Zambia</option>
                      <option value="zw"   >Zimbabwe</option>
                      <option value="rs"   >Serbia</option>
                      <option value="me"   >Montenegro</option>
                    </select></td>
                  <td>  <td><img src="" id="i10" width="20px" height="20px" ></td></td>
                </tr>
                <tr>
                  <td><label for="cPost"> Code Postale : </label></td>
                  <td><input class="txtField" name="cPost" type="text" id="cPost"></td>
                    <td><img src="" id="i11" width="20px" height="20px" ></td>
           
          </tr>
          <tr>
            <td></td>
            <td><input id="btnSub" class="btn" type="submit" onClick="validerform();" value="ENVOYER"></td>
                </tr>
              </table>
            </form>
          </div>
    the valider.js file


    Code:
    function validerform()
    {
    
    alert("Validation");
    	var uName = document.getElementById('userN').value;
    	var pass = document.getElementById('pass').value;
    	var cpass = document.getElementById('cpass').value;
    	var nom = document.getElementById('nom').value;
    	var prenom = document.getElementById('prenom').value;
    	var tel = document.getElementById('tel').value;
    	var adresse = document.getElementById('adresse').value;
    	var ville = document.getElementById('ville').value;
    	var pName = document.getElementById("country").options;
    	var pIndex = document.getElementById('country').selectedIndex;
    	var cPost = document.getElementById('cPost').value;
    	var country = pName[pIndex].text;
    	var prov = document.getElementById('prov').value;
    
    var img1=document.getElementById('i1');
    var img2= document.getElementById('i2');
    var img3= document.getElementById('i3');
    var img4= document.getElementById('i4');
    var img5= document.getElementById('i5');
    var img6= document.getElementById('i6');
    var img7=document.getElementById('i7');
    var img8= document.getElementById('i8');
    var img9= document.getElementById('i9');
    var img10= document.getElementById('i10');
    var img11= document.getElementById('i11');
    
    var etat=true;
    
    
    alert(uName+" UserName\n"+pass+" Password\n"+cpass+" Comfirm Password\n"+nom+" Nom\n"+prenom+" Prenom\n"+tel+" Tel\n"+adresse+" adresse\n"+"\n\n\n"+ville+" ville\n"+cPost+" Code Postale\n"+pName[pIndex].text+" Province\n"+etat+" ETAT\n"+img1.src+" IMG LOCATION\n"+"DONE");
    
    //Tester nom
    
    if(uName!==""){
    	img1.src="./images/ok.gif";
    	document.getElementById('userN').setAttribute('class','valid');
    }
    else
       {
    	img1.src="./images/pasok.gif";
    	document.getElementById('userN').setAttribute('class','invalid');
    	etat=false;
       }
       
    img1.style.visibility='visible';
    
    
    if(pass!==""){
    	img2.src="./images/ok.gif";
    	document.getElementById('pass').setAttribute('class','valid');
    }
    else
       {
    	document.getElementById('pass').setAttribute('class','invalid');
       	img2.src="./images/pasok.gif";
    	etat=false;
       }
    img2.style.visibility='visible';
      
    
    if(cpass!==""){
    	document.getElementById('cpass').setAttribute('class','valid');
    	img3.src="./images/ok.gif";
    	}
    else
       {
    	document.getElementById('cpass').setAttribute('class','invalid');
       	img3.src="./images/pasok.gif";
    	etat=false;
       }
    img3.style.visibility='visible';
     
    
    if(nom!==""){
    	document.getElementById('nom').setAttribute('class','valid');
    	img4.src="./images/ok.gif";
    }
    else
       {
    	document.getElementById('nom').setAttribute('class','invalid');
       	img4.src="./images/pasok.gif";
    	etat=false;
       }
    img4.style.visibility='visible';
     
    
    
    if(prenom!==""){
    	document.getElementById('prenom').setAttribute('class','valid');
    	img5.src="./images/ok.gif";
    }
    else
       {
    	document.getElementById('prenom').setAttribute('class','invalid');
       	img5.src="./images/pasok.gif";
    	etat=false;
       }
    img5.style.visibility='visible';
     
     
    if(tel!==""){
    	document.getElementById('tel').setAttribute('class','valid');
    	img6.src="./images/ok.gif";
    }
    else
       {
    	document.getElementById('tel').setAttribute('class','invalid');
       	img6.src="./images/pasok.gif";
    	etat=false;
       }
    img6.style.visibility='visible';
     
    
    
    if(adresse!==""){
    	document.getElementById('adresse').setAttribute('class','valid');
    	img7.src="./images/ok.gif";
    }
    else
       {
    	document.getElementById('adresse').setAttribute('class','invalid');
       	img7.src="./images/pasok.gif";
    	etat=false;
       }
    img7.style.visibility='visible';
     
     
    if(ville!==""){
    	document.getElementById('ville').setAttribute('class','valid');
    	img8.src="./images/ok.gif";
    }
    else
       {
    	document.getElementById('ville').setAttribute('class','invalid');
       	img8.src="./images/pasok.gif";
    	etat=false;
       }
    img8.style.visibility='visible';
     
    
    if(prov!==""){
    	document.getElementById('prov').setAttribute('class','valid');
    	img9.src="./images/ok.gif";
    }
    else
       {
    	document.getElementById('prov').setAttribute('class','invalid');
       	img9.src="./images/pasok.gif";
    	etat=false;
       }
    img9.style.visibility='visible';
    
     
    if(pName[pIndex].index!==0){
    	document.getElementById('country').setAttribute('class','valid');
    	img10.src="./images/ok.gif";
    }
    else
       {
    	document.getElementById('country').setAttribute('class','invalid');
       	img10.src="./images/pasok.gif";
    	etat=false;
       }
    img10.style.visibility='visible';
    
    
    if(cPost!==""){
    	document.getElementById('cPost').setAttribute('class','valid');
    	img11.src="./images/ok.gif";
    }
    else
       {
    	document.getElementById('cPost').setAttribute('class','invalid');
       	img11.src="./images/pasok.gif";
    	etat=false;
       }
    img11.style.visibility='visible';
    
    
    
    if(etat){
            
    	alert("All good ready to submit");
            document.ajouterform.submit();
    	
    
    		}
    else{
    
    		//alert(this.form.name);
    			alert("Errors on page form not submitted");
    			return false;
    		
        }
    
    
    
    }

    so now it should talk to the controllerJS.js
    but it's not working i have tried many thing ... please help.



    I'd like to have the
    Code:
    $(function(){
    	//if($('#ajouterform').submit || $('#fLogin').submit){
    	
    	$('#fLogin').submit(function(event){
    	// On desactive le comportement par default du navigateur
    	// qui consiste a appeller la page action du formulaire
    	alert("form had been submitted for review");
    	event.preventDefault();
    	
    	var data = "email="+$('#email').val()+"&password="+$('#password').val()+"&action=X";
    	alert(data);
    	$.ajax({
    	type: "POST",
    	url: "bin/controller/controller.php",
    	data: data,
    	success: function(data, statusText, jqXHR) {
        
    	alert(jqXHR.responseText);
    	var xmlDoc=jqXHR.responseXML;
    	
    	$('#login').html(xmlDoc.getElementsByTagName("membre")[0].firstChild.nextSibling.firstChild.nodeValue)
    	.hide()
    	.fadeIn(3500).animate({right:'400px', top:'20px'}, 3500).css({"color":"red","font-size":"25px"}); 
    	
    	
    	}
         
    				
    });
    
    
    return false;           // Prevents browser from loading a new page
    });
    
    
    }});
    I'd like this controller to be as universal as i can have it so i could load the proper form name and data so i could pass it on properly to the php file.

    I'm trying to have both form go through validation and then go through the controller and then to PHP and back to the view.

    Do have the pattern right ?
    Many thanks
    Jonathan


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •