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 6719025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:02:37+00:00 2026-05-26T09:02:37+00:00

Looking for some advice on whether my syntax is correct for this Prototype to

  • 0

Looking for some advice on whether my syntax is correct for this Prototype to jQuery conversion.

I have both frameworks loading at the same time and would like to convert all scripts to jQuery to reduce page load weight and speed.

Prototype

Looking to replicate this in jQuery:

    if (snapshots.items.length < snapshots.total_entries) {
            new Ajax.Request(snapshots.url, {
                method: 'GET',
                parameters: {
                    page: snapshots.current_page + 1,
                    per_page: snapshots.per_page
                },
                onSuccess: function(response) {
                    var start = snapshots.items.length;
                    snapshots.items = snapshots.items.concat(eval(response.responseText));
                    for (i = start; i < snapshots.items.length; i++) {
                        $('snapshots').appendChild(render_snapshot(snapshots.items[i].snapshot));
                        Photo.Carousels.instances[Photo.Filmstrip.carouselIndex].slides.push($('slide_' + snapshots.items[i].snapshot.id));
                        Photo.Carousels.instances[Photo.Filmstrip.carouselIndex].slides[i]._index = i;
                    }
                    snapshots.current_page++;
                    Photo.Filmstrip.currentSnapshot(currentSnapshot);
                }
            });
        }

to jQuery

   if (snapshots.items.length < snapshots.total_entries) {
                            $j.ajax({
                                    url: snapshots.url,
                                    data: {
                                            page: snapshots.current_page + 1,
                                            per_page: snapshots.per_page
                                    },
                                    success: function (response) {
                                            var start = snapshots.items.length;
                                            snapshots.items = snapshots.items.concat(eval(response.responseText));
                                            for (i = start; i < snapshots.items.length; i++) {
                                                    $j('.snapshots').append(render_snapshot(snapshots.items[i].snapshot));
                                                    Photo.Carousels.instances[Photo.Filmstrip.carouselIndex].slides.push($j('slide_' + snapshots.items[i].snapshot.id));
                                                    Photo.Carousels.instances[Photo.Filmstrip.carouselIndex].slides[i]._index = i;
                                            }
                                            snapshots.current_page++;
                                            Photo.Filmstrip.currentSnapshot(currentSnapshot);
                                    }
                            });
                    }
  • 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-26T09:02:38+00:00Added an answer on May 26, 2026 at 9:02 am

    Yes, this looks right – I know jQuery much better than Prototype, so I’m guessing a little, but it makes sense (assuming you’ve used $.noConflict to assign jQuery to $j). The only issue here, as @Greg pointed out in his comment, is the eval – I assume you’re returning JSON data, so if you include the config option:

    dataType: 'json'
    

    jQuery will parse this automatically, in a way that’s safer than a plain eval. In fact, I’m pretty sure that in most cases if you leave this option out, jQuery will sniff your response body and guess intelligently whether to parse it as JSON, XML, HTML, script, or text, in which case your eval would be unnecessary.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just looking for some advice on this one, what exactly is a loading screen
I'm looking for some advice on whether or not I should use a separate
I have some flexibility here so I'm looking for some advice before I lock
Seeking some advice as to whether use jQModal window or instead use the jQuery
Just looking for some advice.. I have two websites on IIS7 which are seperate
just looking for some advice, pointers, and suggestions for further reading. I have: 1
So I've seen this question , but I'm looking for some more general advice:
Looking for some advice on how I might accomplish this MySQL task: I want
Looking for some advice on the best way to implement localization along with client
I'm looking for some advice on the best way to provide a single place

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.