ruby on rails - Make link_to_remote Clickable Only Once -


Code> I'm using. Unfortunately, if you click on more than one link created link, then it reinstates the content

I want to disable the link after first clicking.

This is the code that I am currently using,

  & lt;% = link_to_remote ("# {user.name}",: update = & "# {User.id} _div",: url = & gt; Controller = & gt; "wishlist_ts",: verb = & gt; "load",: id = & gt; user.id},: position = & Gt; "After",: HTML = & gt; {: class = & gt; "# {user.id} _href"})%>  

I know that you can use : success and : full to call javascript, but to me now Not sure how to do this.

Any help would be greatly appreciated. Thank you. There are a few different ways to do this, depending on how you want to do this.

The specified callback (in order):

< Ul>
  • : Loading: The call is made when the browser loads the remote document with the data.

  • : Loaded: The document has been called after the browser loads the remote.

  • : Interactive: Also called, even when the phone can interact with remote documents, even if it has not finished loading.

  • : Success: When XMLHttpRequest is complete, and the HTTP status code is in the 2XX range.

  • : Failure: When XMLHttpRequest is complete, and the HTTP status code is not in the range 2XX.

  • : Completed: XMLHttpRequest is called upon completion (after fire success / failure if they exist).

  • Basically choose when you want to disable it, and use the callback that matches this point to set the onclick attribute on the "return false" link For NT; or something like that. If you do not want to show it anymore, you can also remove the element as well.

    If you want the link to be disabled at the first possible point, what do I do, an event listener for the click event, which is the ID of the link, then click on on onclick = "Return false"; Or you can hide / hide etc.


    Comments

    Popular posts from this blog

    c# - ListView onScroll event -

    PHP - get image from byte array -

    Linux Terminal Problem with Non-Canonical Terminal I/O app -