Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1112845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:46:13+00:00 2026-05-17T02:46:13+00:00

Hi I have a simple ajax search that returns the results in a table.

  • 0

Hi I have a simple ajax search that returns the results in a table. I can extract the XML and display it fine but what I cannot do is get the index number of the data (var Rows) .
When a user clicks the returned result I believe I would need this in order to retrieve all the data in order to use IE $(“name:eq(1)”,data).text();. Can anyone help me please and I hope this makes sense !!, thanks

My Jquery code is here

$(document).ready(function(){ 
  $.ajax({
      type: "GET", 
      url: "search_action.php?" + string ,
      dataType: "xml",
      success: disxml ,

  });
})
}

function disxml(data){
  dv = $('#crmbox')    

  $(data).find('list').each(function() {  
    var name      = $(this).find('name').text(); 
    var cus_id    = $(this).find('mid').text(); 
    var rows        = $(this).eq() ; 
    display = display  + "(" + rows + ")" +  " Name :" + name + " ID :" + cus_id + " <br>" ; 
  })
  dv.html(r); 
};

here is the php that generates my xml

          echo '<results>'  ; 

          while($row = mysql_fetch_array($result)) { 

          $name =           $row['name'] ;
          $major_id =       $row['address1'] ;

          echo '<list>' ; 

          echo '<name>';
          echo $name;
          echo '</name>'; 

          echo '<mid>';
          echo $major_id ; 
          echo '</mid>'; 

          echo '</list>' ; 

          } ; 



          echo '</results>' ;

the extra tag is the close of an earlier function – no relevence to question

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:46:13+00:00Added an answer on May 17, 2026 at 2:46 am

    It sounds like you want the index you’re currently at, in which case use the first parameter passed to the .each() callback, like this:

    $(data).find('list').each(function(row) {  
      var name      = $(this).find('name').text(); 
      var cus_id    = $(this).find('mid').text();
      //row is the index, starting at 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Ajax request that returns search results, and I am dynamically creating
I have created a simple search field that will ajax in relevant search results
i have a simple ajax call which returns html codes, //=======-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-==-=-==-=-=-=-= //SEARCH Submit ===============================================================================
Good Morning, I have a really simple script that works fine on everything but
I have a search page which uses a simple ajax request to get new
I used to have a simple ajax that helped me take all items from
I have a simple jquery/ajax request to the server which returns the structure and
I have made a simple code for ajax to call a page but it
I am simply learing Ajax with jQuery and have a simple page method that
I have a search that returns JSON, which I then transform into a HTML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.