Jump to content

miracle_potential

Members
  • Posts

    135
  • Joined

  • Last visited

    Never

Everything posted by miracle_potential

  1. I cant remember the specific error it gave me now but it really protested against it. Also I've hit another problem with my Ajax, its all working and stuff but I have one extra problem thats probably somethign so stupid I'm missing it completely My Ajax script pulls open a page which in turn has links on it, and the links are supposed to perform the same action as the initial function so basically page opens(with onload feature) and links are shown->link clicked->ajax functions reused to load new content But it says that loadsite is undefined, which is wierd because the function was used to pull up the links ??? my code is // Get the HTTP Object function getHTTPObject(){ if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP"); else if (window.XMLHttpRequest) return new XMLHttpRequest(); else if (!window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP"); else if (!window.XMLHttpRequest) return new XMLHttpRequest(); else { alert("Your browser does not support AJAX. Please download Mozilla Firefox"); return false; } } // Change the value of the outputText field function setOutput(){ if(httpObject.readyState == 4){ document.getElementById('productspage').innerHTML = httpObject.responseText; } } // Implement business logic function loadSite(url){ httpObject = getHTTPObject(); if (httpObject != null) { httpObject.open("GET", url, true); httpObject.send(null); httpObject.onreadystatechange = setOutput; } else { getHTTPObject(); } } var httpObject = null; And the link is <a href="javascript:loadsite('http://new.noirorchidemporium.co.uk/includes/new_prod_constructor.php?paction=catagory_catalogue&catagory=test');">test</a> I've tried adding new to it and all sorts but I dont understand because i have a body onload using that function <body id="productspage" onload="loadSite('http://new.noirorchidemporium.co.uk/testhelp.php?paction=catagories');">
  2. Its not so much that lol I just need it to do like a window.location thing but it doesnt like that at all
  3. http://nodstrum.com/2007/09/19/autocompleter/ Uses Jquery its quiete simple but theres a tutorial
  4. Almost there! made a new topic because the original question of my last was solved, leaving me with but one error. I'm getting type mismatch which is an error with the onreadystatechange but I cant seem to fix it ??? can anyone sift through this and tell me if I'm doing anything wrong? function GetAjax() { try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { } try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { } if (typeof XMLHttpRequest != 'undefined') { return new XMLHttpRequest(); } throw new Exception('No AJAX support'); } function new_cont(url) { var aobj = GetAjax(); aobj.open('GET', url, true); aobj.onreadystatechange = HandleSendResponse(); aobj.send(null); } function HandleSendResponse() { document.getElementById("pcatchd").innerHTML = GetAjax.responseText; } Thanks guys
  5. Ah I just commented out the window.location() and it worked. How could I get it to forward to the error reporting system I've programmed if there is an error?
  6. I'm getting there, having one last issue I keep getting object doesnt support this action and I cant work it out I've used alerts to show me all thats going on and cant find it. <script type="text/javascript" language="javascript"> function GetAjax() { try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { } try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { } if (typeof XMLHttpRequest != 'undefined') { return new XMLHttpRequest(); } throw new alert('No AJAX support'); } function new_cont(url) { try { var aobj = GetAjax(); aobj.open('GET', url, false); aobj.send(null); aobj.onreadystatechange = HandleSendResponse(aobj); } catch (e) { window.location('http://new.noirorchidemporium.co.uk/errors/help/?error=2'); } } function HandleSendResponse() { var naobj = GetAjax(); if(naobj.readyState==4){ document.getElementById("pcatchd").innerHTML = naobj.responseText; } } </script>
  7. Well I can post my PHP script as well if need be but I'm sure that wont help anyone. I put commers around the pcatchd (ID of my div) and it still does nothing. I've got myself an Ajax book which I'll read when I get home but for now I'd quite like to see a real person fix or at least clue I love a challenge but this is totally confusing haha. The code hasnt changed except I've taken out the new klaus. The page is jsut a debugging page witha div in it where I have a PHP class that pulls URL data and works from there. http://new.noirorchidemporium.co.uk/testhelp.php?paction=catagories
  8. Ok I worked out the "Object required" error but now haha theres no debugging information on this problem at all I'm in the process of finding a good Ajax IDE but just for now so I can actually learn something TT the links when pressed do absolutely sod all haha Basically the solution was instead of having the div definition outside of the function call on the link I put it as the first passing variable in the brackets (simple I know) And the links are now <a href="javascript:new_cont(pcatchd, '?paction=category_catalogue&category=test_category')">test link</a> But its just not doing anything at all... and all I need it to do is give that link to the function as "text" and it reload the url with the variables assigned in the link as innerHTML. function GetAjax() { try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { } try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { } if (typeof XMLHttpRequest != 'undefined') { return new XMLHttpRequest(); } throw new Exception('No AJAX support'); } function new_cont(obj,text) { try { var aobj = new GetAjax(); aobj.open("GET", "new_prod_constructor.php" +text, true); var p = "s=" + encodeURI(obj.innerHTML); aobj.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); aobj.setRequestHeader("Content-length", p.length); aobj.onreadystatechange = HandleSendResponse; aobj.send(null); } catch (e) { window.location('http://new.noirorchidemporium.co.uk/errors/help/?error=ajx'); } } function HandleSendResponse() { if(GetAjax.readyState == 4){ document.getElementById("pcatchd").innerHTML = this.responseText; } } And I spelt category right this time
  9. I'm playing with it right now with my slight grasp on hehe. :] I understand that this is a POST function but what I don't understand is how I get the GET variables for my PHP to catch because I have a switch to catch those evil ones that play with the URL and to keep my code tidy. I've changed the function call that was for a non existent function but it still says object missing and line one character one so I'm pretty stumped out I'm still toying with it though :] thanks for your advice though guys :]
  10. Ok I did some research on tizag on Ajax and learnt a few things on Javascript and thanks to you guys I have the best part of an Ajax script but I cant seem to get it to work I constantly get the error "Object expected" Below is the Ajax code I'm trying to use. function GetAjax() { try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { } try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { } if (typeof XMLHttpRequest != 'undefined') { return new XMLHttpRequest(); } throw new Exception('No AJAX support'); } function new_cont(obj,text) { //obj is the same thing as an object returned by something like document.getElementById() try { var aobj = new GetAjax(); aobj.open("POST", "new_prod_constructor.php"+text, true); var p = "s=" + encodeURI(obj.innerHTML); //the post params. encodeURI is known to have some problems, but it'll be fine for this ;p //set some headers just in case aobj.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); aobj.setRequestHeader("Content-length", p.length); aobj.onreadystatechange = HandleSendResponse; aobj.send(p); } catch (e) { alert('error code1'); //worst error handling ever. EVER! } } function HandleSendResponse() { if(ajaxRequest.readyState == 4){ document.getElementById("pcatchd").innerHTML = this.responseText; } } And this is an example of the link I have in the div not entirely sure I fully understand all of this. <a href="javascript:new_cont(''paction=catagory_catalogue&catagory=catagory')">Catagory Here</a> If it isnt that clear I need the link to send the "text" to the function so when the innerhtml changes it loads differant URL variables for me to use in my PHP class Thanks guys all your help is greatly appreciated :]
  11. OK, I've left the login thing for now haha I need to work something out for the products section as you probably saw I was having issues with loops last time. Fixed that But I just need to know the best way to do this. And if this will even work 0.o <script type="text/javascript" language="javascript"> <!-- function change(catagory, paction, ID) { document.getElementById('productsDIV').innerHTML = "<img src='images/loading.gif' alt='Loading Please Be Patient' />" //cant work out how to set the variables for this http.open('POST', 'testhelp.php?paction='+paction+'&catagory='+catagory); http.onreadystatechange = ajaxction; http.send(null); } function ajaxction() { if(http.readyState == 4){ var newcontent = http.responseText; document.getElementById('productsDIV').innerHTML = 'There Was An Error :['; } else{ document.getElementById('productsDIV').innerHTML = ''+newcontent+''; } //--> </script> On the page will be a container div which will have LOTS of little divs inside it might make it a table either way! and I cant work out how I'd get an onclick function on the divs to send a variable to the Ajax and reload the page according to what "link" was pressed. Not even sure if this is going to work I'm a total newbie with Ajax usually just use Iframes but Ajax will look better on the ol' CV and just so you know there are multiple functions in my PHP class controlled with a switch so I need someway of getting the accoriding next action along with whatever catagory is clicked (the section I'm on). But for now just getting a div to post to Ajax will help me loads I can work stuff out from there. <3 Google hehe
  12. Man Google was getting sick of me searching for it I swear haha. Thanks bro! I really wanted to have a read through something like this and just learn because most tutorials have blurbs not code comments so its hard to see what did what.
  13. Oops sorry about that guys! Bit of a wierd night. lol Ok I'm trying to make an Ajax function myself how do I call an external file to the innerHTML for the div?
  14. Lol Corbin thanks for your code but it was especially the Ajax part I needed xD I just dont know where to start I saw some tutorials on Jquery but it didnt seem to fit what I was after. Thanks you guys so far!
  15. Mines just a lyric from a favourite song of mine. Couldnt really have what I wanted. "Moral guilt and science have collided". The songs "The Great Debate" from Dream Theaters double disc album 6 Degrees Of Inner Turbulance  ;D
  16. I've tried a couple of things now to no avail. What I'm trying to do is have a login page with a div in the bottom which has a login form inside it. I was trying to trigger the login process with an onsubmit() function once the users been validated to use an innerHTML function to show that users details and such. All without reloading the page. but I'm not a JS or Ajax programmer just a PHP programmer so where to start with the JS is a bit like looking for a needle in a haystack. Any help would be greatly appreciated.
  17. http://new.noirorchidemporium.co.uk/Iframes/products/catagories Thats what I'm getting though ??? Sorry I didnt post code and sorry about the double post but this is really bugging me. I will post code tonight.
  18. I'll get it to you this evening after work
  19. $profileID = $_SESSION['id']; header("Location: www.fullurl.com/profile.php?id=" . $profileID); And check your using the correct cases on your session names done that a few times myself! haha
  20. $query = mysql_query("SELECT * FROM table NOT RLIKE '^[the ]' AS c.name ORDER BY c")or die("error"); while($row = mysql_fetch_assoc($query){ echo $row['c']; } Not sure if this is going to work to be totally honest because I havnt tested it and I'm not a Regex programmer but its deffo a hint as to where you should be looking. Hope ya get the idea I'm shattered! :-X :-\
  21. $query = mysql_query("SELECT * FROM table ORDER BY name DESC") or die(mysql_error()); while($row = mysql_fetch_assoc($query){ echo str_replace('the ', ' ', $row['name']); } --EDIT-- Oops sorry misunderstood the question hang on
  22. .htaccess thing you could change manually unless your talking gigabytes sort of stuff in which theres no real hope
  23. Ok lol I changed the if statement to what you guys suggested and (as I thought) made no differance. I tried debugging it and it just seems that the internal loop is escaping after the first time round on the main loop. I really dont have a clue whats going on with it if you guys want to work this out be my guest it would make things a little easier in the long run but I think I'm going to have to do it with XML transformations.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.