Jump to content

DrRossi

Members
  • Posts

    19
  • Joined

  • Last visited

DrRossi's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello, I am trying to load more search resutls in my search.php with this code <script> function yHandler($q){ var result= document.getElementById('mydiv'); var contentHeight = result.offsetHeight; var yOffset = window.pageYOffset; var y = yOffset + window.innerHeight; if(y >= contentHeight){ var query = "<?PHP echo $_POST['search']?>"; $.ajax({ type: "POST", url: "search.php", $q:query, success: function(res) { $("#more").append(res); } }); } } window.onscroll = yHandler; </script> My biggest problem is that it will load the page with no results because the $q is not correctly sent. If I try alert(query); it shows the search term so the problem must be when im defining my data in the ajax request. Any ideas? Thanks in advance
  2. removed the "@" sign and worked perfect. Thank you all!!
  3. OMG removed the "@" symbol and now it works smoothly! Thanks for your help!!!
  4. error found when I click the button Syntax error, unrecognized expression: input[@name=510]:checked throw new Error( "Syntax error, unrecognized expression: " + msg ); By the way that error won't show up in chrome's firebug, but it comes up in firefox firebug.
  5. Okay found it. well I never used the console before just the html button to check the source code. Thanks for that tip. When I just define the accu as a number or text or even as rID it will come up with the "POST test.php" and the parameters etc. But when i try $("input[name=" + rID + "]:checked"); it will not do the POST test.php
  6. what do you mean? Sorry I am new to php and javascript. $("input[name=" + rID + "]:checked"); is in my function. If i view the source code I can see my button's attributes...
  7. well i tried it without quotes, single quotes..... nothing worked. Any suggestions?
  8. I am trying to get the radio's button value from the form to the javascript onclick function to my database. I define my $output in first.php then echo it in second.php. Here is my first.php $name = 100; $answer = "some text"; $output .= '<div id="'.$k.'"> <form id='.$f.' > <input type="radio" name='.$name.' value="yes" checked>Accurate <input type="radio" name='.$name.' value="no">Not Accurate <input type="button" id='.$j.' value="Submit" onclick="sendData(\''.$answer.'\','.$name.',)"> </form> </div>' ; $name++; My jquery function in second.php function sendData(feel, rID) { var accu = $("input[@name=rID]:checked").val(); $.get("test.php", { feeling: feel , accuracy: accu} ); } When I click my button nothing is submitted. If i manually define var accu to "YES" or something it works. So the problem must be on how to check if my radio button its checked and get its value.
  9. I tried at least 4 different ways, 1 of them which didn't work is: var answer = $("input[@name=accuracy]:checked").val(); It didnt submit anything. If i manually define var answer to "YES" or something it works. So the problem must be on how to check if my radio button its checked and get its value.
  10. You are a GURU. I mean you can solve problems without even seeing the code?! Solved that too. I was as you said but I have added an if statement in my test.php in order to execute the INSERT query only when the "real stuff" were defined. If you could give me your opinion on one last problem I have I would be even more grateful to you. My last problem (hopefully ) is that I want to get the value of the radio button that was checked in the javascript function in order to pass it to test.php as well. Is there a simple way or I need an extra function in my function or something? Thanks
  11. Any thoughts why I have 2 entries in my database (1 correct and 1 empty) for each of my buttons clicked?
  12. Ok, text string works perfectly with the \' as you suggested. The only strange thing that is happening is that along with the normal entry in the database, another empty entry is added for each one.
  13. Oh yea, it worked but I could swear that I tried that before I will try now to do the same with text in the string to see if it works. You are awsome PFMaBiSmAd
  14. it is a number but I am going to add some text as well. Well the thing is that as I said earlier, in my second.php which I echo my $output, if I view the source the $answer is correctly there like <input type="button" id="104" value="Submit" onclick="sendData(1)"> but its not adding it in the database. It adds an empty value instead. The problem seems to be with the jquery function function sendData(feel) { $.get("test.php", { feeling: 'feel'} ); } or with my sql code any ideas? I appreciate your help. Thanks
×
×
  • 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.