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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:59:21+00:00 2026-05-12T06:59:21+00:00

I know why the post fails, but I’m not sure how to resolve it

  • 0

I know why the post fails, but I’m not sure how to resolve it and I can’t find any other references to this. I’m taking our references to jEditable to make this simpler, as it happens without the jEditable plugin.

So how the heck do I “escape” the keyword so that it posts correctly? Here’s relevant code:

Test

<script type="text/javascript">
$(function() {
    $('#button').click(function() {
        $.ajax({
            type : 'POST',
            url : 'ajax/post_cms.php',
            dataType : 'html',
            data : {
                id : '1',
                data : '<p>This is a test of the system that shows me an alert !</p>'
            },
            success : function(data) {
                console.log(data);
            },
            error : function(XMLHttpRequest, textStatus, errorThrown) {
                console.log('An Ajax error was thrown.');
                console.log(XMLHttpRequest);
                console.log(textStatus);
                console.log(errorThrown);
            }
        });
    });
});
</script>

<input type="button" name="button" value="button" id="button" />

When it errors out, it’s throwing the “error:” callback function, and the “errorThrown” is logged as undefined. I’m positive it’s the word “alert” because if I spell it “allert” in the one place it appears, everything posts just fine. If you take out the HTML (so it’s just “data : ‘This is a test of the system that shows me an alert !'”) it works just fine.

XMLHttpRequest = “XMLHttpRequest readyState=4 status=0 multipart=false”
textStatus = “error”
errorThrown = “undefined”

GAH!! HELP!!

  • 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-12T06:59:22+00:00Added an answer on May 12, 2026 at 6:59 am

    UPDATE:
    The problem was a firewall catching the AJAX request as a XSS attack. If you’re experiencing problems similar to those exhibited below, make sure to check your environment.

    Symptoms:

    1. Post data is failing with an error code of 0
    2. Post data works in other places but not in your environment
    3. Post data works as long as it doesn’t contain any javascript functions
    4. Your library doesn’t seem like it should be at fault based on documentation
    5. You can’t find a bug in your library.

    I think there’s something else wrong here other than jQuery.
    Your initial example works fine for me.

    See a working example here: http://jsbin.com/ifami

    Note: I had to change your the ajax URL to a valid url but otherwise there were no other changes.

    That being said, you could try encoding your values as URI components:

    <script type="text/javascript">
    $(function() {
            $('#button').click(function() {
                    $.ajax({
                            type : 'POST',
                            url : 'ajax/post_cms.php',
                            dataType : 'html',
                            data : {
                                    id : '1',
                                    data : encodeURIComponent('<p>This is a test of the system that shows me an alert !</p>')
                            },
                            success : function(data) {
                                    console.log(data);
                            },
                            error : function(XMLHttpRequest, textStatus, errorThrown) {
                                    console.log('An Ajax error was thrown.');
                                    console.log(XMLHttpRequest);
                                    console.log(textStatus);
                                    console.log(errorThrown);
                            }
                    });
            });
    });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have already read this post , but I am not sure know to
I know there is this post , but I still want to know more
I cant post the code (proprietary issues) but does anyone know what types of
( I don't know whether should I also post this question to ServerFault, since
Do you guys know how I can use the Curl command line to POST
I am updating this post with what I think I now know about getting
I am not sure how to find out more about whats wrong with my
I know this topic has been beaten into the ground, but I'm really stumped.
This is my first app with CI and I want to know whether $_POST
I know you should use POST whenever data will be modified on a public

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.