php - Auto Fill second textbox with first textbox input -


Fill auto text with the input of the first text box. Like I choose Jane as the first name, I want the second text box to get the last name from the database and fill the auto with the DO. I can not find any auto input on the second texbox, not sure what I'm doing.

Here is the test.php code

  & lt ;? Php? & Gt; & Lt; Script src = "jquery-1.11.1.min.js" & gt; & Lt; / Script & gt; & Lt; Script & gt; $ (Document) .ready (function () {$ ("# firstName"). Change (function () {var firstName = $ (this) .val (); if (firstName! = '') {$ .ajax ( {Type: "post", url: "insert_process.php", data: "firstname =" + first name, datatype: "Jason", success: work (data) {$ ("# last name"). Val (Data ); $ ('#Anam'). CSS ("background-color", "# B3 CBD6") $ ('#name'). Amify ({background color: "#FF",})} }}}}} And {$ ("#lastname"). Val ("");}})}}; & lt; / script & gt; & gt; DOCTYPE html & gt; & lt; html & Gt; & lt; top & gt; Title & gt; System Requests & lt; / title & gt; & lt; / head & gt; & lt; body & gt; & lt; div align = "center" & Lt; fo Style = "width: 285px; height: 192px" Name & lt; br & gt; Input type = "text" id = "first name" name = "first name"> gt; & lt; br & gt; & amp; nbsp; last name & lt; br & gt; ; & Lt; input type = "text" id = "lastname" name = "last name" & gt; & Lt; Br> & Lt; Br> & Lt; Input type = "submit" value = "submit name" & gt; & Lt; Br> & Lt; / Form & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt; And then here is the insert_proccess.php code  

  & lt? Php header ('content-type: application / jsan'); $ Host = "Localhost"; $ User = "root"; $ Db_name = "people"; $ Pass = "systems399"; $ Con = mysql_connect ($ host, $ user, $ pass); $ Db_conx = mysql_select_db ("People", $ Conn); $ Fname = $ _POST ["First name"]; $ Sql ​​= "SELECT * names before WHERE firstName = '$ fname'"; $ Query = mysqli_query ($ db_conx, $ sql); $ Line = mysqli_fetch_array ($ query2 MYSQLI_ASSOC); $ Rc = $ line ["last name"]; Echo json_encode ($ rc); ? & Gt;  

what is actually sent Going Request (can you check the Networking tab)? Can you alert the returned data? To be more useful I basically need more information that at a quick glance, the process is failing completely, try to install your data structure in this way:

  Data: {"firstName": first name}  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -