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

  • Home
  • SEARCH
  • 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 6026111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:23:55+00:00 2026-05-23T04:23:55+00:00

I have a page as below: <head> <script type="text/javascript" src="jquery-1.6.1.js"></script> <script type="text/javascript"> $(document).ready( function()

  • 0

I have a page as below:

<head>
<script type="text/javascript" src="jquery-1.6.1.js"></script>
<script type="text/javascript">
$(document).ready( function() {
  var i = 1;
$('#prev').click(function() {
  $.ajax({
  type: 'POST',
  url: 'ajax.php',
  data: 'id=' + i,
  dataType: 'json',
  cache: false,
  success: function(result) {
    $('#content1').html(result[0]);
    $('#content2').html(result[1]);
    $('#content3').html(result[2]);
    $('#content4').html(result[3]);
    $('#content5').html(result[4]);
    $('#content6').html(result[5]);
  },
  });
  i++;
});
});
</script>
</head>
<body>
<table>
<tr>
<td id="prev">prev</td>
<td id="content1">X</td>
<td id="content2">X</td>
<td id="content3">X</td>
<td id="content4">X</td>
<td id="content5">X</td>
<td id="content6">X</td>
<td id="next">next</td>
</tr>
</table>
</body>

The code works well, but is there any solution to do this in one step? I mean if I can provide content 1-6 a common class content instead of specific ids. How can I do this if content cells don’t have a specific ids (from content1 to content6and has a common class content)?

  • 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-23T04:23:55+00:00Added an answer on May 23, 2026 at 4:23 am

    Take a look to the .each() iterator

    $('.content').each(function(index){
         $(this).html(result[index]);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page which may has about more than 1 form like below.
Here is my code <html xmlns=http://www.w3.org/1999/xhtml> <head runat=server> <title></title> <script type=text/javascript src=<%= ResolveUrl(Scripts/jquery-1.3.2.min.js) %>></script>
I have a initializor.js that contains the following: if(typeof jQuery=='undefined') { var headTag =
I have a html page ( editor.php ) which contains a lot of html
Doubt this is possible as I don't have a 1 page app, but pretty
i have the following basic script to make an api call to vimeo and
I have this code below. It works fine in safari however in IE the
I have following 2 files as below: <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
I have done enough research and have decided to move the JavaScript to the

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.