Jump to content

takn25

Members
  • Posts

    98
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

takn25's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Hi, Ill post the code first. $(function() { $('.follow').click(function(){ var name=$(this).attr('name'); var info= 'test=' + name; $.ajax({ type: "GET", url: "yes.php", data: info, success: function(data){ $('.test_results').html(data); } }); }) }) <body> <button name='yabadaba' class="follow" > </button> <div class='test_results'> </div> <button name='whatsup' class="follow" > </button> <div class='test_results'> </div> </body> Ok as you can see there are two buttons and two div classes which are the same except the name difference between the buttons. What I want to achieve when the result comes from PHP I only target the div class below the button and not show the results in all the divs with the class test_result. Any help is appreciated thanks.
  2. Ok I am sorry this might be asking a bit too much but I will post my code could you kindly tell me where am I suppose to put this as I am totally lost!. I would like to test the value with an alert() also thanks! <script type="text/javascript" src="http://yui.yahooapis.com/combo?2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script> <script type='text/javascript'> function insert() { // checking browser if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); }else { xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { document.getElementById('message').innerHTML = xmlhttp.responseText; } } // passing data to php parameters = 'text='+ YAHOO.util.Dom.getElementsByClassName('hey').value;// getElementbyId works fine here. trying yahoos function xmlhttp.open('POST','update.inc.php','true'); xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded'); xmlhttp.send(parameters); } </script> <body> <button type='submit' class='hey' value='ya' name='daba' onclick="insert();"/> </button> <div id='message'> </div> </body>
  3. Hi, Thanks for helping but tbh this is like my 3rd 4th time using javascript. I am mostly trying to create something with AJAX. I am just stuck at extracting the value it works fine with document.getelementbyId but with this function from yahoo cant do anything and cant even find a better function similar to the yahoos.
  4. Hi, I was in need of a function getelementbyclass after searching a while I found that Yahoo has created a similar function. Ok its working fine, the problem I am facing is that I have been able to find the class with their function but I have not been able to extract a value out of it like we do with document.getElementById('').value This is their link for the function http://developer.yahoo.com/yui/dom/#getElementsByClassName (sorry I don't know if I am allowed to post links or not) Below is a button with the class 'hey' with yahoos function I am able to show that hey is a Html button but I am having trouble extracting the value which for this instance is 8 <button type='submit' class='hey' value='8' name='daba' onclick="insert();"/> </button> The reason for this function is I have multiple buttons with different values. Please any help would be appreciated If some one can guide me how I can extract the value!
  5. Hi, I am stuck at this place could some one guide me. For instance I can get the element by id but there are about 10-20 buttons with different Ids and Values so I want to know can I get the element by something that works for all the buttons. 'text='+document.getElementById('8').value; <button type='submit' value='8' id='8' onclick="insert();"/> </button> The value and id differ from each other there is another button with different ids and values. So is there something I can come up with that will work for all the buttons? <button type='submit' value='9' id='9' onclick="insert();"/> </button>
  6. Hi, I am not the best with Javascript or Ajax I just want to perform a tiny thing. I want to know how can I pass a GET variable in an anchor tag to PHP Ill explain further below. <script type='text/javascript'> function load() { if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); }else { xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { document.getElementById('adiv').innerHTML = xmlhttp.responseText; } } xmlhttp.open('GET', 'include.inc.php', true); xmlhttp.send(); } </script> </head> <body> <?php echo "<a href='#' onclick='load();'>click </a>" ?> <div id='adiv'> </div> Ok focus on this part which is <a href='#' onclick='load();'>click </a>. Instead of # there would be some primary number generated through mysql. For instance ?cid=25, ?cid=26 and so on you get the picture. I want to know how can I pass these to my include.inc.php. Lastly I would like to know what should my url be for these to pass because I used to extact data from mysql and echo URLS as <a href=' include.inc.php?$cid' > </a> If I do this now wont this just directly take me to the page So what is the proper way of passing stuff. Thanks any help is appreciated hope I made some sense was kinda hard explaining!
  7. Hi, I want to know is there a simpler of achieving this. I have a table called part it has a row called HD. The HD stores a number which is not unique. I will provide a visual example below to explain further. Table HD 42 42 42 What I am after is a query something like Pile HD in stacks of 3. For example there are 3 HD with the number 42. That is 1 stack if there were 6 HD with the number 42 that would equal 2 stacks and so on. I can do some sort of maths to get the results but would like to know is there a query I can come up with to show how many stacks of 3 are there?
  8. Hi, I used to do form validations in a totally different manner before this that aside. I would like to know how can I do something like this. What happens here is if none of the conditions are met I echo a div containing the error and so on. The problem I am facing is If the first condition is not met it goes to the second condition and at the end there are two error divs at the same time. I want to perform something like, if first condition is not met script stops, echos only the div where the condition is not met and the script does not carry on. If i use the die or exit functions it dies and html dies with it any solutions or another way? if (strlen($title)<=19) { echo "<div id='error'><div id='error_img'><img src='images/warning.gif' width='16' height='16' title='error' /></div> must of be atleast 20 characters. </div>";; } if ($on=="-1") { echo "<div id='error'><div id='error_img'><img src='images/warning.gif' width='16' height='16' title='error' /></div> Please select. </div>"; } any help is appreciated thanks!
  9. Hi, I have a table for the users detail in the database which stores their avatar and stuff. There is another called part, this is where the users unique ID from the users table is posted, so I can join these both tables and retrieve the data accordingly. The user table has a few rows for avatars for example avatar_1 , avatar_2 and avatar_3 these rows have paths to different avatars. The problem I am facing is the user table is looking really ugly :-\ thanks to these extra avatar rows. What I want to achieve is create a different table for avatars to store these 3 rows but I was wondering how will I join 3 of these tables the user table, the part table and finally the avatar table or should I do something else? Thanks any help is appreciated!
  10. Ok I got some thing to work but havent really got the hang of it just yet. Its grouping the results and showing them but I am not able to ORDER the results for instance from the most to the least. I mean what am I suppose to ORDER it by ? $query = "SELECT id, COUNT(*) as kb FROM part GROUP BY id"; $result = mysql_query($query) or die(mysql_error()); // Print out result while($row = mysql_fetch_array($result)){ echo "There are ". $row['kb']; echo "<br />"; } Thanks again!
  11. Hi again, Here is the code $string .= (substr($string,-1) == '-') ? '' : '-'; I know what this code does but to increase my knowledge could some one tell me what is the question mark symbol for ( ? ) and what is the colon doing. As I have seen the ? in a lot of scripts but have no clue what it does and what its used for cheers!
  12. Hi, I have table called done in mysql and there is a row which is filled with the users id and another row with todays date. Now what I want to know which three users participated the most with filling out stuff on the website according to todays date. For instance First user filled out 5 2nd user filled out 3 3rd user filled out 2 You get the idea. I dont know what type of query should I write to extract the data based on the users id and how many times they participated on the particular day. Another example of the table is 1st column user id = 20 time= todays date 2nd column user id= 20 time = todays date Showing the user participated twice on the day. Thanks any help is appreciated.
  13. Hi, There is a feature in cpanel called optimize website and when you go in it there is a field to fill Compress the specified MIME types. My question is this the correct way to optimize PHP CSS JS did i enter the mime types correctly? text/html text/plain text/xml/css/application/x-httpd-php/application/x-javascript
  14. Hi, Could some one kindly explain what is mod_gzip or point me to a good tutorial which explains step by step configuration for mod_gzip and how to run and test it. Thanks much appreciated.
×
×
  • 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.