By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,988 Members | 1,341 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,988 IT Pros & Developers. It's quick & easy.

JQuery Script Not Working:

P: 2
So I'm a nube when it comes to JQuery and JavaScript as I mostly write PHP. My Jquery connection via google is working as I've tested it. However I'm not sure whats the problem is. The code is designed to count new messages and display the number of new messages. Code as follows:

Expand|Select|Wrap|Line Numbers
  1. <script>
  2. $(document).ready(function() {
  3. var refreshId = setInterval(function(){
  4. $.ajax({
  5. type: "GET",
  6. url: "include/php/inboxcount.php",
  7. data: 'p=' +<? echo $username;?>.val(),
  8. success: function(count1){
  9. $('#showinboxcount').html(count1);
  10. }
  11. });
  12. });
  13. });
  14. </script>
  15.  
And the PHP code which is working fine is:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. include_once "conn/db.php";
  3. $p = stripslashes(trim(htmlspecialchars($_GET['p'])));
  4. $s = mysql_query("SELECT * FROM conversations WHERE (sender = '$p' AND starterstatus = 'unread') OR (recipient = '$p' AND recipientstatus = 'unread') ORDER BY date");
  5. $i = 0;
  6. while($row = mysql_fetch_array($s)) {
  7.     $i++;
  8. }
  9. echo $i;
  10. ?>
  11.  
Any help would be really appreciated.
Oct 8 '15 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.