470,596 Members | 1,144 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,596 developers. It's quick & easy.

JQuery Script Not Working:

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
0 997

Post your reply

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

Similar topics

2 posts views Thread by Jim Burgess | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.