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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:46:53+00:00 2026-05-26T13:46:53+00:00

My question is about an error I have when I use jQuery.ajax in my

  • 0

My question is about an error I have when I use jQuery.ajax in my javascript function. I searched and found similar question, but none of these questions helped me.

So, what’s really weird is that it was working before. I spent a few days working on translations problems with UTF-8 and when I tried it again after, it was working anymore. I can’t see what happened so maybe you can help me find out.

Here is the code from my controller action which is called for ajax.

$project =$_GET['project'];

//Call private function getQuota    
$quotaTab = $this->getQuota($project);   

    $this->_helper->getHelper('viewRenderer')->setNoRender();
Zend_Layout::getMvcInstance()->disableLayout();

// Encode data to return
$return = array(
    'quota' => $quotaTab[0],
    'usedSpace' => $quotaTab[1],
    'usedPercentage' => $quotaTab[2]
    );
$return = Zend_Json::encode($return);

$this->getResponse()->setBody($return);

And this is my javascript function containing the ajax function

function  changeQuota() {

var fileset = document.getElementById('fileset'); 

jQuery.ajax({
     url: '/filesets/quota/',
     data: ({ project: fileset.value, ajaxCall: true}),
     success: function(response) {
          //Decode the JSON response
          var result = response.evalJSON();

          // Set the new value of current quota
          $('currentQuota').value = result.quota; 

    var strUsed = <?php echo "' ".$this->translate("used")."'";?>;
    $('usedQuota').innerHTML = result.usedPercentage.concat(strUsed);

    var suggestQuota = Math.round(parseFloat(result.quota) + parseFloat(result.quota/10));

    $('quota').value = suggestQuota;

    $('usedSpace').value = Math.round(result.usedSpace);
         }
      });       
}

So I debug my script with Firebug, and the exact error that it returns is
“JSON.parse: unexpected non-whitespace character after JSON data
return JSON.parse(json); prototype.js (line 720)”

I have this error in both functions when I use jQuery.ajax. The error happens when trying to evalJSON().

Any idea why it doesn’t work anymore ? Could it be because of the encoding(currently UTF-8) of the files ?

Thanks in advance for your help !

P.S. Maybe it’s not linked, but when I open prototype.js with Zend Studio, I have some warnings and 2 errors(“missing semi-colon” at line 4235 and “Syntax error on token “,”, . expected” at line 4000. When I noticed that, I downloaded latest version and it didn’t change.

  • 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-26T13:46:54+00:00Added an answer on May 26, 2026 at 1:46 pm

    You could trim the final string before it is sent out? If that isn’t the case make sure it’s encoded without Byte Order Mark, especially if you’re using dream weaver with UTF-8.

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

Sidebar

Related Questions

I have quick question about jQuery plugins, hope somebody out there has some advice.
I have a question about MIMEParsingException. I use Java EE 6 with NetBeans 6.8.
I have a question about jQuery Plugins . I am using a checkbox styling
Note: This similar SO question talks about how to build the same class, but
I have a question about PHP sessions. I use a session to keep a
This question is similar to this one about animation queues , but the answers
I have a question about error/exception handling on the iPhone. I've read the documentation
I have a question about this error and hope someone has ran into it
I already asked a question about this yesterday, but now I have another :)
I have a question about PHP require() function. I have a PHP script called

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.