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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:45:40+00:00 2026-05-15T14:45:40+00:00

I am running an AJAX call in my MooTools script, this works fine in

  • 0

I am running an AJAX call in my MooTools script, this works fine in Firefox but in Chrome I am getting a Uncaught SyntaxError: Unexpected token : error, I cannot determine why. Commenting out code to determine where the bad code is yields nothing, I am thinking it may be a problem with the JSON being returned. Checking in the console I see the JSON returned is this:

{"votes":47,"totalvotes":90}

I don’t see any problems with it, why would this error occur?

vote.each(function(e){
  e.set('send', {
    onRequest : function(){
      spinner.show();
    },
    onComplete : function(){
      spinner.hide();
    },
    onSuccess : function(resp){
      var j = JSON.decode(resp);
      if (!j) return false;
      var restaurant = e.getParent('.restaurant');
      restaurant.getElements('.votes')[0].set('html', j.votes + " vote(s)");
      $$('#restaurants .restaurant').pop().set('html', "Total Votes: " + j.totalvotes);
      buildRestaurantGraphs();
    }
  });

  e.addEvent('submit', function(e){
    e.stop();
    this.send();
  });
});
  • 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-15T14:45:41+00:00Added an answer on May 15, 2026 at 2:45 pm

    I have just solved the problem. There was something causing problems with a standard Request call, so this is the code I used instead:

    vote.each(function(element){                
      element.addEvent('submit', function(e){
        e.stop();
        new Request.JSON({
          url : e.target.action, 
          onRequest : function(){
            spinner.show();
          },
          onComplete : function(){
            spinner.hide();
          },
          onSuccess : function(resp){
            var j = resp;
            if (!j) return false;
            var restaurant = element.getParent('.restaurant');
            restaurant.getElements('.votes')[0].set('html', j.votes + " vote(s)");
            $$('#restaurants .restaurant').pop().set('html', "Total Votes: " + j.totalvotes);
            buildRestaurantGraphs();
          }
        }).send(this);
      });
    });
    

    If anyone knows why the standard Request object was giving me problems I would love to know.

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

Sidebar

Related Questions

I am running this php script from an ajax call: <?php require_once('myConnectDB.inc.php'); //add beer
This is an ajax file running the following code: $model = Mage::getModel('catalog/product'); //getting product
I'm running a form through an AJAX post call, but the value on my
I am running an ajax call and it works perfectly the first time it
I have created an jquery ajax call and it is working fine in Chrome,
I'm running into trouble accessing global variables when I make an AJAX call to
I occasionally have some long running AJAX requests in my Wicket application. When this
I am really suffering here trying to get this ajax call to work, sorry
If I have a synchronous ajax call running, and an asynchronous call is made
I am using a javascript var to control the running of an ajax call.

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.