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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:18:12+00:00 2026-06-11T21:18:12+00:00

When submitting a form using jQuery and AJAX, I am getting a 403 error

  • 0

When submitting a form using jQuery and AJAX, I am getting a 403 error on my returned HTML that contains an IMGtag.

Here’s the code that I’m using to submit the form:

// Add a new personality to the quiz
    $('form#personality_editor').submit(function(e) {

        e.preventDefault();

            // Submit the form with jQuery Form plugin to handle attachments
            $(this).ajaxSubmit({
                dataType: "json",
                resetForm: true,
                beforeSend: function() {
                    // Show the loading spinner
                    $('img#personality_loader').show();
                },
                success: function(add_personality_response) {

                    // Hide the image loader
                    $('img#personality_loader').hide('fast');

                    if (add_personality_response["success"] == "true") {

                        // Create a new personality in the list of personalities
                        $('div#quiz_personalities').append(add_personality_response["personality_html"]);

                            // Add the personality to list of hidden personalities
                            AddRemovePersonality(add_personality_response["personality_id"], "add");

                            // Set the focus on to personality name
                            $('input#new_personality_name').focus();

                            // Show or hide the no personalities notice
                            ShowHideNoPersonalitiesNotice();

                            alert("Success");
                    }

                },
                error: function() {
                    alert("There was an error adding personality");
                }
            });

    });

Here’s the full JSON response that I’m getting back from the code:

    {"success":"true","personality_id":191,"personality_name":"Avril Lavigne","personality_image":"191avril.jpg","personality_html":"<div class=\"personality_wrapper\" data-personality-id=\"191\"><img src=\"images\/personalities\/personality_images\/192avril.jpg\" class=\"personality_image_small\" \/><div class=\"personality_info\"><div class=\"personality_name\" title=\"Kjh\">Kjh<\/div><div class=\"personality_options\"><a href=\"#\" class=\"personality_option personality_edit\">Edit<\/a><a href=\"#\" class=\"personality_option personality_delete\">Delete<\/a><\/div><\/div><\/div>"}

It is the personality_html that I am adding to the DOM using the .append() function of jQuery.

This problem is occurring in Internet Explorer, because it is working in Chrome.

The image is uploading fine to my server at the location images/personalities/personality_images/192avril.jpg.

The response that I’m getting back from the page is:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /&quot;images//personalities//personality_images//192avril.jpg/&quot;
on this server.</p>
</body></html>

Is it something to do with the escaped data being passed from my page? I am using json_encode() before I echo it in response.

Here’s the view from the Developer tools in IE:

Developer tools IE

  • 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-11T21:18:14+00:00Added an answer on June 11, 2026 at 9:18 pm

    You are most likely trying to parse JSON to a JavaScript object twice.

    Since for the .ajaxSubmit() call you have already designated that the response data type is JSON, jQuery will automatically parse the response into a JavaScript object for you (it would also do this if the response Content-Type is application/json, regardless of whether you had specified dataType or not).

    This means that inside the success callback, add_personality_response1 will already be a JavaScript object. Yet you are trying to $.parseJSON it a second time:

    var add_personality_response = $.parseJSON(add_personality_response1);
    

    I ‘m not quite sure if removing this line will solve the problem immediately, but it’s definitely how you have to start.

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

Sidebar

Related Questions

I am getting Error in submitting the form using AJAX and Jquery, following is
I started out with this code for submitting a form using the jQuery ajax
I'm loading form into jquery-ui dialog using jquery.html() function and then Submitting doesn't work
I want to interrupt and prevent a form from submitting using jQuery. Here's my
I'm uploading a file using jQuery through Ajax. I'm submitting some form elements also,
I am using ajax form submit. Here, i am using jQuery serialize .I like
So I have a form and I'm submitting the form through ajax using jquery
I am using jQuery 1.7.2 version and I am submitting my form using Ajax
I faced the following issue while I submitting my form using jQuery FORM and
I have formatted my form using uniform jquery plugin. Also for submitting the form

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.