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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:55:29+00:00 2026-06-08T14:55:29+00:00

I am ajaxing a page and on success I have following code: success: function(html){

  • 0

I am ajaxing a page and on success I have following code:

success: function(html){
var product_json = [];
data=$(html);

$(".product_json", data).each(function(){
      product_json.push( jQuery.parseJSON( $(this).html() ) );
});
....
//code continue 

My Json looks like:

{
  "item_logoagenzia": "/resource/loghi/medium/13.gif",
  "item_description": "Some Bernini ven.."
}

It works fine if I have some chars like double quotes it stopped working.

Error Json looks like:

 {
  "item_logoagenzia": "/resource/loghi/medium/13.gif",
  "item_description": "Some "Bernini" ven.."
}

I do not have control over json creation. How to modify it or remove special characters like double qoutes in script given above?

  • 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-06-08T14:55:31+00:00Added an answer on June 8, 2026 at 2:55 pm

    I have done it. I modified my code:

    $(".product_json", data).each(function(){
      product_json.push( jQuery.parseJSON( $(this).html() ) );
    });
    

    to

    $(".product_json", data).each(function(){
    var myString = $(this).html().split('"item_description":"');
    
    var myStringDesc = myString[1]; //split the string into two
    
    myStringDesc = myStringDesc.substring(0, myStringDesc.length - 2);
    
    myStringDesc = escapeHtml(myStringDesc);//escapeHtml is just function for removing special chars
    
    var myNewString = eval( '('+ myString[0]+'"item_description":"'+ myStringDesc+'"}'+')');
    
    myNewString = JSON.stringify(myNewString);
    
    product_json.push( jQuery.parseJSON( myNewString ) );
     });
    

    I am not sure about efficiency of the code but it looks like it works fine.

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

Sidebar

Related Questions

I have the following function which is for ajaxing in a page and the
I have some Ajaxing going on and I have 2 blocks of source code.
I have the following code, and database. My intent is the end user can
I'm ajaxing an array of images from a file with php opendir function .
I'm currently AJAX'ing a login form. var data = $(this).serialize(); This is the data
I have a page where I want to display some points on map. I
I see thousands of posts that have to do with ajaxing wordpress but none
I have a gallery of images that I'm ajaxing in and I'd like to
I'm ajaxing some search results onto a page, and trying to do stuff when
I am ajaxing in some text from a PHP script and trying to have

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.