Hi all.

First off this is my first interaction with jquery (and I hope this is the correct forum to put questions about this in, if not might a mod take the liberity of moving it to the correct forum?), so apologies if I'm overlooking an entire room made of elephants.

First off a bit of explaining -- I've an ongoing project where I interface to my mobile phone's network provider with a program I write in C using the libcurl library. The website provides the ability to send text messages with, what was, a simple form that I used post to, but they recently upgraded it to jquery/ajax, and I've been stumped in being able to mimic the behaviour I get in the browser with my program.

When I want to add a contact to receive a text message I have to click on his name. And as best I can understand it it is stored in a database until I click 'send message' and then the DB is erased. So I'm trying to mimic the clicking on a contact and what I'm having problems with is replicating this code (snipped from the website).

// This function is called whenever a user contact 
  // name is clicked 
  $('div.userContact > img').click( function () {
    // Make a copy of this for the post's callback function
    var self = this;
    // Perform the post
        user: getUserID($(this)),
        login: getLoginID()
      function (replaceHTML) {
        replaceContactHTML(self, replaceHTML)

Is it reasonable to expect that to post the following would achieve the same thing as clicking on the link? addContact.php?user=userID&login=whateverTheLoginIDis (I can get the id's fine, and have verified it). I thought it was, so tried going to that URL in my libcurl program and it failed. And even tried pasting the URL into the address bar in my browser and it failed too.

By failed I mean this. When I click on the link an image that said "add contact" changed to an image that said "remove contact". This is the desired behaviour. So I thought it would make sense that were I to go to that link it'd give me a picture of "remove contact" and if I looked at the IDs associated with the image (via view source) they'd all be from the user id code that I passed in. However. That is not the case. What happens is that I get an "add contact" and when I look at the ID I get something like id="userContact_" rather than id="userContact_contactID" that I get when the jquery is performed.

Am I missing something with my post? If anyone can help me with this I'd really appreciate it.


Edited by twomers: n/a

7 Years
Discussion Span
Last Post by twomers

I figured it out.
I wasn't posting to the url with libcurl properly. Read some curl documentation and fixed it. All's good with the world.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.