How do I use jQuery sortable?

What is a way to use @mentions on a website using PHP, JavaScript, or jQuery?

  • I am in the process of creating a website, and I'm wondering how can I use @mentions using PHP or JavaScript or jQuery? jQuery would be preferable, since it's fast and easy to use. But if there is no way of implementing it using jQuery or JavaScript I wouldn't mind using PHP.

  • Answer:

    You should use JavaScript (with or without jQuery) and PHP. 1) In JS you identify the "@" and displays suggestions typed according to the users available is displayed. You can use the jQuery autocomplete: http://docs.jquery.com/Plugins/autocomplete 2) The suggestion, of course, must come from the database, so you'll need to use PHP to serve a page. You choose: either to request that list when the page loads, or order by AJAX when the user enters the "@".

Shankar Cabus at Quora Visit the source

Was this solution helpful to you?

Other answers

You might want to take a look at the official "Twitter text" libraries if you would like to match the familiar use in Twitter status messages. https://github.com/mzsanford/twitter-text-php

Niall Kennedy

Describing your intended functionality would be helpful. If you just want to display tweets that mention your site, you can use the Twitter Search Widget. In that case "@mysite" would be the search query. http://twitter.com/about/resources/widgets/widget_search If you want to get mentions for names users enter (or you supply dynamically), that can easily be done entirely with jQuery and the Twitter Search API. http://search.twitter.com/api/ Here's an example. $( function () { var username = 'mashable'; $.getJSON( 'http://search.twitter.com/search.json?q=%40' + username + '&callback=?', function ( response ) { $( response.results ).each( function ( i, result ) { var html = '<div>' + '<a href="http://twitter.com/' + result.from_user + '"><b>' + result.from_user + '</b></a> ' + result.text + ' ' + '<a href="http://twitter.com/' + result.from_user + '/status/' + result.id_str + '">' + result.created_at + '</a>' + '</div>'; $( 'body' ).append( html ); } ); } ); } ); To store the results, or anything else, you'd need to get PHP involved.

Todd Iceton

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.