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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:37:07+00:00 2026-05-20T19:37:07+00:00

I am getting the invalid label error now I have upgraded my jQuery. I

  • 0

I am getting the invalid label error now I have upgraded my jQuery. I read that the new 1.5 version is now more strict on the JSON encoding. Although I use Zend_Json::encode(array(“content”=>$result)); to encode the HTML so would of thought this would .

I read in the manual that it has been updated although cant get this to work without parse errors.
jQuery JSON Manual

Error: invalid label
Source File: http://domain.local/register/#
Line: 0, Column: 1
Source Code:
{"content":"<div id=\"captcha_captcha.json\">\r\n<div class=\"input\">\r\n\t<div class=\"text-small\"><input type=\"text\" size=\"12\" name=\"captcha.json[input]\" id=\"captcha_id\" \/><\/div> \r\n\t<img src=\"http:\/\/domain.local\/tmp\/captchas

This is my JavaScript code.

function regenerateCaptcha<?php echo $params["name"]?>(){
    captcha_id = "captcha_<?php echo $params["name"]?>";

        $.getJSON("/default/captcha/regeneratecaptcha/name/<?php echo $params["name"]?>.json", function(data){
               success : pasteCaptcha<?php echo $params["name"]?>
        });
    } 

    function pasteCaptcha<?php echo $params["name"]?>(json){
        $("#captcha_<?php echo $params["name"]?> .input").replaceWith(json.content);
    }

And when I view the source of the URL:

{"content":"<div id=\"captcha_captcha\">\r\n<div class=\"input\">\r\n\t<div class=\"text-small\"><input type=\"text\" size=\"12\" name=\"captcha[input]\" id=\"captcha_id\" \/><\/div> \r\n\t<img src=\"http:\/\/fantasyolympics.local\/tmp\/captchas\/6498c75d8e3f9b8ed2cbb7a066f962a6.png\" class=\"captcha\" width=\"185\" height=\"36\" \/>\r\n    <input type=\"hidden\" name=\"captcha[id]\" value=\"6498c75d8e3f9b8ed2cbb7a066f962a6\" \/>    \r\n    <a href=\"#\" onclick=\"regenerateCaptchacaptcha();return false;\" class=\"captcha_refresh\" title=\"Try a new code\"><\/a>\t\r\n<\/div>\r\n<\/div>\r\n<script type=\"text\/javascript\">\r\n\tfunction regenerateCaptchacaptcha(){\r\n\t\tcaptcha_id = \"captcha_captcha\";\r\n\r\n\t\t$.getJSON(\"\/default\/captcha\/regeneratecaptcha\/name\/captcha.json\", function(data){\r\n            success : pasteCaptchacaptcha\t    });\r\n\t} \r\n\t\r\n\tfunction pasteCaptchacaptcha(json){\r\n\t\t$(\"#captcha_captcha .input\").replaceWith(json.content);\r\n\t}\r\n<\/script>\r\n"}
  • 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-20T19:37:08+00:00Added an answer on May 20, 2026 at 7:37 pm

    I solved a similar problem just now.

    The reason jQuery throws an invalid label error is that it expects services to respond in JSONP format not JSON format. If your service responds in JSON format you will get this error message.

    The workaround for this is to make an asynchronous call to your service and then parse your result with jQuery.parseJSON. To call a service that responds in JSON format your code should look something like this:

        function createRequest() {
           try { return new XMLHttpRequest(); } catch(e) {}
           try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
           alert("XMLHttpRequest not supported");
           return null;
         }
    
        var request = createRequest();
        request.open(“GET”, HTTP://URL.of.service.to.call, true);
        request.onreadystatechange = callback;
        request.send(null);
    
       function callback() {
            if(request.readyState != 4) { return }
            ObjectYouWant = $.parseJSON(request.responseText);
        }
    

    I got this solution working in my app by adapting code found on AjaxPatterns.org and the jQuery.com

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

Sidebar

Related Questions

I'm getting the invalid lvalue error using gcc 3.4.6. The line that invokes the
Im getting frustrated because of OpenDNS and other services (ie: roadrunner) that now always
I have a web service that uses Python's SimpleJSON to serialize JSON, and a
Struggling with Bing's json request (bing search, not map), I am getting an error
Using sql server 2008 I am getting and invalid precision value error in the
I have some problems getting the custom formated JSON data into a dijit.form.FilteringSelect. It
I'm getting an 'Invalid XML Data' error for any Fusion Chart which contains a
I'm having some problems getting my object to gracefully fail out if an invalid
Getting started with jquery and having trouble getting hello world type example going for
I getting the following error when I try to connect to my server app

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.