Jump to content

fugix

Members
  • Posts

    1,483
  • Joined

  • Last visited

Posts posted by fugix

  1. Hey guys, im starting to learn ajax and im trying an example that is not working for me..here is my script..

    <span id='ajaxButton' style='cursor:pointer; text-decoration: underline'>Make a Request</span>
    
    <script type='text/javascript'>
    
    (function()  {
    var httpRequest;
    document.getElementById("ajaxButton").onclick = function() { makeRequest('test.html'); };
    
    function makeRequest(url)  {
    	if (window.XMLHttpRequest)  {
    		httpRequest = new XMLHttpRequest();
    	} else if (window.ActiveXObject)  {
    	try  {
    		httpRequest = new ActiveXObject("Msxml2,XMLHTTP");
    	      }
    	catch (e)  {
    		try   {
    			httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
    		} 
    	catch (e)  {}
    		}
    	}
    
    	if (!httpRequest)  {
    
    		alert('Giving up  cannot create an XMLHTTP instance');
    		return false;
    	}
    	httpRequest.onreadystatechange = alertContents;
    	httpRequest.open('GET', url);
    	httpRequest.send();
    	}
    
    	function alertContents()  {
    
    		if (httpRequest.readyState === 4)  {
    			if(httpRequest.status === 20)  {
    				alert(httpRequest.responseText);
    	} else  {
    
    		alert('There was a problem with the request');
    	}
    }
    }
    }
    )();
    
    </script>

     

    I keep getting the alert "alert('There was a problem with the request');" as my result as opposed to the response text....if anyone can spot my error i would appreciate it

     

  2. why not fenway?

     

    Because it goes against the entire principle of proper database design. Do you really think ALTER TABLE .. ADD COLUMN .. is a better alternative to a simple INSERT INTO .. VALUES ..? Not to mention the performance hit you'll take for choosing to use an ALTER TABLE approach since the entire table will lock every time you add a new 'category' leaving thousands of your users waiting for the table to be unlocked.

     

    noooo that wasnt what i was suggesting at all that a terrible idea...sorry if I was misunderstood

  3. Who cares about their certifications. They have good, solid examples of many techniques and it is laid out in a way where you can get answers, especially on those really stupid 'I should know this' stuff.

     

    It is ONLY a resource, nothing more. Their AJAX samples are right on the money and the one explaining how to integrate JAVASCRIPT with PHP is really easy to grasp and use.

     

    You may want to look at the w3fools site again, as it isn't just a warning about certifications.  w3schools is a flawed resource, as they get a lot wrong.  Mistakes, bad practices, wrong information, etc.  There are better resources out there.  In fact, w3fools lists them.

     

    Here's all you need to know about AJAX, straight from the people who make JavaScript: https://developer.mozilla.org/en/AJAX

    that's great nightslyr, thank you

  4. I agree with you to a certain degree...just wanted to point that out to you as many people strive to earn their certifications....thank you for your reply i appreciate your help

  5. to set your name to a session you can do something like

    $_SESSION['name'] = $example_name

    to create a cookie refer to http://us3.php.net/manual/en/function.setcookie.php

    Also, i advise against using $_SERVER['PHP_SELF']; you can google it to see why..

    And I believe you are receiving multiple refreshes etc. because you are trying to incorporate javascript and php in a way that will not give you the results that you want.

×
×
  • 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.