Note that there are some explanatory texts on larger screens.

plurals
  1. POPhp Js Ajax I need some assistance
    primarykey
    data
    text
    <p>I am trying to create a social dating site and I have my problem in the Add as Buddy Button. When you click it, my site should be sending the uid of the sender (from_uid) and the uid of the receiver (to_uid) to the database. It sends out the from_uid successfully but the to_uid always sends 0.</p> <p>PHP</p> <pre><code>&lt;div class="member" data-user="&lt;?php echo $member['xmpp_user']; ?&gt;" data-uid="&lt;?php echo $member['uid']; ?&gt;"&gt; &lt;input type="hidden" id="hiddenuid" value="&lt;?php echo $member['uid']; ?&gt;"&gt; &lt;img src="https://s3.amazonaws.com/wheewhew/user/&lt;?php echo $member['uid']; ?&gt;/photos/&lt;?php echo $member['profile_pic']; ?&gt;" /&gt; &lt;div class="member_name"&gt;&lt;?php echo $member['firstname']." ".$member['lastname']; ?&gt;&lt;/div&gt; &lt;div id="addbutton"&gt;&lt;button type="submit" class="add"&gt; Add as Buddy &lt;/button&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>Javascript</p> <pre><code>&lt;script type="text/javascript"&gt; var BOSH_SERVICE = 'http://wheewhew.com:5280/http-bind'; var connection = null; var xmpp_user = "&lt;?php echo $xmpp_user; ?&gt;@wheewhew.com/default"; var xmpp_pass = "&lt;?php echo $xmpp_password; ?&gt;"; var uid = "&lt;?php echo $uid; ?&gt;"; $(document).ready(function () { $('#btn-logout').click(logout); $('.add').click(addBuddy); connectXMPP(); //updateLastSeen(); }); &lt;/script&gt; </code></pre> <p>jabber.js</p> <pre><code>function addBuddy(){ var xmpp_user = $(this).parent().attr('data-user')+'@wheewhew.com/default'; var to_uid = $(this).parent().attr('data-uid'); $.ajax({ type: "POST", url: "./ajax/addBuddy", data: "from_uid="+uid+"&amp;to_uid="+to_uid, success: function(data) { var ret = eval('('+data+')'); if(ret.status == 'success'){ connection.send($pres({to:xmpp_user,type:'subscribe'}).tree()); } } }); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload