I have a list of categories with different titles from A-Z. I want to sort the categories alphabeticaaly on clicking a particular alphabet... I have used jquery and ajax..

Alphabetics placed are as follows

                            foreach($a as $char){
                            echo "<a href='javascript:void(0)' class='faq_letter'  rel='".$char."'>".$char."</a>";

The script is as follows

<script type="text/javascript">
                            var letter = this.rel;
                            var xmlhttp;
                            if(window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
                                xmlhttp=new XMLHttpRequest();
                            else{// code for IE6, IE5
                                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                                if (xmlhttp.readyState==4 && xmlhttp.status==200){

However an errors occurs near the line xmlhttp.send(); called as uncaught exception: Syntax error, unrecognized expression: . What could be the problem?

faq_categories.php page

    $letter = $_GET['title'];
    $sql1 = "SELECT * FROM faq_categories WHERE title LIKE '".$letter."%' ORDER BY title";
    $query1 = mysql_query($sql1);
    echo "<div id='categoriesList'>";

    echo $result1['title']."<br/>";

    else if(mysql_num_rows($query1)==0){
    echo "No results found";
    echo "</div>";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.