javascript - Website does not work when moving the files to another server? -


![enter image description here][1]i'm trying troubleshoot problem. created basic asp page javascript in 1 server works fine @ moment when move asp page , related files new server not work. asp page ask last or first name in text box , has button after press returns matches contact info. microsoft access database.

html :

<!doctype html public "-//w3c//dtd html 4.01 transitional//en"> <html> <head> <!-- jquery library used phone_dir.js can use jquery --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>      <title>corporate phone directory</title>     </head>      <body bgcolor="#ffffff" link="#003399">      <br>      <br>      <div style="font-size: 16px; font-family: arial; color:#d6d6d6;">        <table width="745" height="81" border="0" align="left" bordercolor="#003399">       <tr>     <td width="300" height="50" align="left" valign="top">     <div align="left" valign="bottom">     search either first or last name:      <br>     <br>              <input name="search" type="text" id="search" value="">           <input name="btnfind2" type="button" id="btnfind2" value="find"   onclick="searchphonedirectory()">      </div>        </table>       </div>       <br>        <br>        <br>        <br>        <br>        <br>        <br>         <hr>         <div style="font-size: 16px; font-family: arial; color:#d6d6d6;"  align="left"   id='results'>        <!-- results go here -->        </div>        </body>      </html> 

javascript :

$(document).ready(function()      {      $( "#search" ).keypress(function()         {         if(event.keycode==13)          {             $("#btnfind2").click();         }; // end of if key code = enter function     });    });   function searchphonedirectory()  {       var searchentry = document.getelementbyid('search').value;      if (window.xmlhttprequest)     {         xmlhttp2=new xmlhttprequest();     }     else     {         xmlhttp2=new activexobject("microsoft.xmlhttp");     }     xmlhttp2.onreadystatechange=function()     {       if (xmlhttp2.readystate==4)        {         document.getelementbyid("results").innerhtml =   xmlhttp2.responsetext;        }       }      xmlhttp2.open("get","phoneresults.asp?searchentry="+searchentry,true);      xmlhttp2.send();   }; 

other code generates results.

 <!--#include file="aspfiles/phonedirectory.asp" -->       <%            response.expires=-1        err.clear       on error resume next  '*----------------------------------------------------------------    searchentry = request.querystring("searchentry")  '*----------------------------------------------------------------        sql = "select phonedirectory.name, phonedirectory.[phone#], phonedirectory.officeextension,       phonedirectory.[mobile#] "      sql = sql +"from phonedirectory "      sql = sql +"where (phonedirectory.lastname '" & searchentry & "%' or           phonedirectory.firstname '" & searchentry & "%' ) "      sql =  sql + "order lastname,firstname"       set rs=server.createobject("adodb.recordset")      rs.open sql,conn        'response.write(sql)        response.write("<table>")        response.write("<td width='22%' align='left' height='29'>name</th>")        response.write("<td width='11%' align='left' >phone</th>")        response.write("<td width='1%' align='left' >ext</th>")        response.write("<td width='12%' align='left' >mobile</th>")        response.write("</tr>")       until rs.eof       response.write("<tr>")  each x in rs.fields      response.write("<td align='left' >" & x.value & "</td>")  next  rs.movenext  response.write("</tr>")        loop         response.write("</table>")      %>     

this 1 opens database:

    <% ' filename="connection_odbc_conn_dsn.htm" ' type="ado"  ' designtimetype="ado" ' http="true" ' catalog="" ' schema="" 'dim mm_phonedirectory_string 'mm_phonedirectory_string = "dsn=phonedb;"    set conn=server.createobject("adodb.connection")  conn.provider="microsoft.jet.oledb.4.0"  'testing db  conn.open(server.mappath("/webs/corporatenet2/databases/phone_directory.mdb"))     %> 

first thing missed mention event" in keypress event , remove searchphonedirectory() function html input "onclick",

 <input name="btnfind2" type="button" id="btnfind2" value="find"> 

add javascript code this.

 $( "#search" ).keypress(function(event)   {     if(event.keycode==13)      {        searchphonedirectory();     }; // end of if key code = enter function }); //end of search keypress function 

hope helps.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -