optikalefx Posted August 11, 2007 Share Posted August 11, 2007 im learning how to do a live search, and the way i do that is by getting a working script to break down and play with i found one at w3schools. but the codes dont work... can someone find out why? http://www.w3schools.com/php/php_ajax_livesearch.asp the example on their site works, but when i try it it just shows a text field, and a border...? Quote Link to comment https://forums.phpfreaks.com/topic/64360-live-search-example-with-ajax/ Share on other sites More sharing options...
cooldude832 Posted August 11, 2007 Share Posted August 11, 2007 Its sorta tricky because the live search actually returns the results into the text box (I think) what you need to do is apply a div that will receive the return of the ajax function and then insert that string into the box. It will take some playing with in JS to format it to nice results, but it isn't too difficult. Quote Link to comment https://forums.phpfreaks.com/topic/64360-live-search-example-with-ajax/#findComment-320927 Share on other sites More sharing options...
optikalefx Posted August 11, 2007 Author Share Posted August 11, 2007 well i was thinking that but on the example they have, it actually shows up as a div box underneath of the textbox what i dont get, is if i copy the code they gave me, (even the link rel stylesheet they use) and i dont get what they do,... what could i have done wrong Quote Link to comment https://forums.phpfreaks.com/topic/64360-live-search-example-with-ajax/#findComment-320930 Share on other sites More sharing options...
cooldude832 Posted August 11, 2007 Share Posted August 11, 2007 if you use firefox check the error console for possible js errors Quote Link to comment https://forums.phpfreaks.com/topic/64360-live-search-example-with-ajax/#findComment-320932 Share on other sites More sharing options...
optikalefx Posted August 11, 2007 Author Share Posted August 11, 2007 huh it says xmlHTTP not defined and thats for livesearch.js Quote Link to comment https://forums.phpfreaks.com/topic/64360-live-search-example-with-ajax/#findComment-320934 Share on other sites More sharing options...
cooldude832 Posted August 11, 2007 Share Posted August 11, 2007 you must have a function called xmlHTTP in js (i'm not an expert but my guess) and its nto being defined i.e your included docs aren't properly set up Quote Link to comment https://forums.phpfreaks.com/topic/64360-live-search-example-with-ajax/#findComment-320936 Share on other sites More sharing options...
optikalefx Posted August 11, 2007 Author Share Posted August 11, 2007 this is the defintion (not js expert either...) function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } i mean this is exactly what w3schools.com gave me, i have changed nothing yet Quote Link to comment https://forums.phpfreaks.com/topic/64360-live-search-example-with-ajax/#findComment-320937 Share on other sites More sharing options...
cmgmyr Posted August 11, 2007 Share Posted August 11, 2007 Check this out...you can also download the complete source to mess with it. http://www.dynamicajax.com/fr/AJAX_Suggest_Tutorial-271_290_312.html Quote Link to comment https://forums.phpfreaks.com/topic/64360-live-search-example-with-ajax/#findComment-320938 Share on other sites More sharing options...
optikalefx Posted August 11, 2007 Author Share Posted August 11, 2007 not having luck... i think i just need to walk away for tonight. i created the table using their sql commands, that worked fine. i edited the database.php with my server info that i use for the same database on other sites so i know it works. and i get loaded their files onto my server, and nothing i think its just a bad luck night Quote Link to comment https://forums.phpfreaks.com/topic/64360-live-search-example-with-ajax/#findComment-320941 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.