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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:44:51+00:00 2026-05-23T08:44:51+00:00

I’m facing a bit of an odd problem here. I just launched: http://claudiu.phpfogapp.com/ To

  • 0

I’m facing a bit of an odd problem here. I just launched: http://claudiu.phpfogapp.com/ To keep it short, when you minify your files or custom code or both, it returns a JSON string containing various data:

{
    "source" : MINIFIED_CSS,
    "location" : CSS_URL,
    ...
    "error_msg" : ERROR_MSG
}

Where the words typed in caps are actually the values. It works for a few lines of code, but breaks on large values of MINIFIED_CSS. It’s weird that JavaScript doesn’t issue any errors as well. I read the JSON with jQuery like this:

$.get('/minify/', {custom: $('.custom textarea').val(), files: JSON.stringify(request_string)}, function(data) {

                    console.log(data);
                    var response = eval(data);

When the MINIFIED_CSS is too large, I can’t even see the console.log() call, but inspecting with Firebug you can see the source and can also see the JSON tab in Firebug for the request parsing the JSON nicely.

I have no idea what could be wrong. I’m sure that the JSON string doesn’t break, I even created a small CSS file with the most awkward characters that could break the JSON: http://claudiuceia.info/css/small.css but minifying that runs smoothly. Did anyone face this problem before? Any ideas what could be wrong?

Hoping that having an actual link to the problem can help finding a solution quicker but if you need anything else please let me know, I don’t know what else I could try. Also, note that this stopped working just now, but it worked when I launched a few hours ago? I tested in Chrome and Firefox and it worked, now it doesn’t work in any of them.

UPDATE

I followed Scottie’s suggestion (comment below) and ran the response through JSONlint.com The requests that I’m having problems with don’t validate in JSONLint but running them through eval() doesn’t issue an error and converts nicely: http://claudiuceia.info/demo/json/index.html

I’m expecting to see that, or at least an error or the console.log() call in the live app as well. The console.log() call should display even if data is null or undefined or whatever it might be.

Pictures with the requests working but not being read by JavaScript as well:

Firebug JSON tab for the request

Firebug response tab for the request

UPDATE 2

Looks like json_encode() didn’t escape the CSS text properly for some reason. I had to use a solution found on this page: PHP's json_encode does not escape all JSON control characters

$escapers = array("\\", "/", "\"", "\n", "\r", "\t", "\x08", "\x0c"); 
$replacements = array("\\\\", "\\/", "\\\"", "\\n", "\\r", "\\t", "\\f", "\\b"); 
$result = str_replace($escapers, $replacements, $value); return $result;
  • 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-23T08:44:51+00:00Added an answer on May 23, 2026 at 8:44 am

    If .custom textarea text is too long, you may exceed the maximum URI length error, resulting in HTTP 416 status code (you can see status code of the request in firebug console as well, usually it marks in red all request that are not with status 200 response. So you have to use $.post instead of $.get

    Edit: based on the discussion below, the question is why callback function is not being called. Here is the answer :

    The callback function is called only if the request succeeds. Since the response contains content-type application/json and browser can’t parse json (the xmlhttp object contains statusText ‘parseerror’) the callback is never executed. If you add ‘text’ as last parameter to $.post() in order to parse the response as text, the callback will be executed and response will be logged

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but

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.