![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
fugix
-
Posts
1,483 -
Joined
-
Last visited
Posts posted by fugix
-
-
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
-
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
-
also if you wanted to show the entire array you would have
$myArr = array("Hi", "I'm", "an", "array"); $an = $myArr[]; print_r($an);
-
PROBLEM SOLVED....I feel like an idiot....was entering the wrong password
this comment made me laugh
-
are you talking for SEO?
-
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
-
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
-
yeah, as old car points out..basically gareth you were cancatenating your variables incorrectly which lead to you having one too many double quotations...there are several ways to concatenate, really up to personal choice..
-
try
$awayoption.="<OPTION VALUE=\"{$afname} {$alname}\">".$afname." ".$alname;
-
do you get a valid int when this line is parsed
echo "$recordCount Rows\n";
-
word of caution...before you trust w3schools...look at this site..http://www.w3fools.com but i did look at their ajax section and it looks legit...thank you
-
what do you get when your var_dump($data) ?
-
a join can be used to join two or more tables together either where fields of different tables are equal or not... look here
-
anyone know of a good site that teaches AJAX well?
-
welcome to phpf tommy. Hopefully we can help you with whatever you need in your php journey
-
this website here explains alot about htaccess and how to manipulate urls etc.
-
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.
-
check this out here. they list a few things to try
-
might want to try this
$file = file_get_contents("http://localhost/TA/nw.html"); preg_match_all('/To:(.*?)Subject:/i', $file, $matches);
-
is your date field in you database using the DATE format? if so, the format that you will need to use is YYYY-MM-DD
-
Well in your $params array it looks like you are building a mysql query but you never actually call it in the code that you have posted
-
in your query why dont you add an ORDER by t.score DESC clause
-
could make a table with category names as fields and insert each video in the correct field
Oh, please don't ever make categories field names!!!
why not fenway?
-
for a quick lesson on the apache mod_rewrite module...read here
simple AJAX script
in Javascript Help
Posted
found the error..the status code needs to be 200 not 20...silly error