[ 5 posts ]

Lee Trussell

  • Username: LTumbleweed
  • Joined: Thu Aug 12, 2010 9:41 am
  • Posts: 4
  • Offline
  • Profile

Using io-base with onclick for get request

Post Posted: Thu Aug 12, 2010 9:47 am
+0-
Hi,

I'm new to YUI and I'm finding it hard to understand. I'm trying to emulate youtubes inbox/comment system where you click a link and it produces the message using ajax. The trouble I'm having is assigning the onclick event to each message subject.

Thomas S. Sha

YUI Contributor

  • Username: tsha
  • Joined: Thu Jan 08, 2009 10:16 am
  • Posts: 206
  • Offline
  • Profile

Re: Using io-base with onclick for get request

Post Posted: Thu Aug 12, 2010 9:57 am
+0-
What have you tried so far? Specifically:
- How are you attaching the event listeners?
- How are you calling io to retrieve data?

Let's see with what you have, currently, and where are you having difficulties.

Regards,
Thomas

Lee Trussell

  • Username: LTumbleweed
  • Joined: Thu Aug 12, 2010 9:41 am
  • Posts: 4
  • Offline
  • Profile

Re: Using io-base with onclick for get request

Post Posted: Thu Aug 12, 2010 11:08 am
+0-
At the moment I'm using ajax code from w3schools, I have used the yui to post data from a form ok. What I'm really looking for is an example of retrieving data from a get call from several (2 would do) links.

Thanks for replying.

Lee Trussell

  • Username: LTumbleweed
  • Joined: Thu Aug 12, 2010 9:41 am
  • Posts: 4
  • Offline
  • Profile

Re: Using io-base with onclick for get request

Post Posted: Thu Aug 12, 2010 11:09 am
+0-
<script>
YUI().use("io-form",
function(Y) {

function postcomment() {

alert(args);

Y.io('./cms/getcontactinfo.php?id='+id);

Y.on('io:success', onSuccess, this);
Y.on('io:failure', onFailure, this);
};
function onSuccess(id,response,args) {

alert(response.responseText);

};
function onFailure(id,response,args) {
alert("Error, retry...");

};
Y.on('click', postcomment, '#contact_click_me', this, true);
});

</script>

Thomas S. Sha

YUI Contributor

  • Username: tsha
  • Joined: Thu Jan 08, 2009 10:16 am
  • Posts: 206
  • Offline
  • Profile

Re: Using io-base with onclick for get request

Post Posted: Thu Aug 12, 2010 2:48 pm
+0-
Here is an example to help you get started: http://gist.github.com/521901

Regards,
Thomas
  [ 5 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum