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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:24:18+00:00 2026-05-23T11:24:18+00:00

Working on a submission form with ajax, json and PHP. The data is handled

  • 0

Working on a submission form with ajax, json and PHP. The data is handled properly with the DB, but this script, with alert(data.success), says data.success is undefined. If I alert(data), it shows what i need is there {"success":"http:\/\/myaddress.com"}

function confirmSubmit() {
$.ajax({
    type: 'POST',
    url: 'index.php?route=payment/authorize/send',
    data: $('#authorize :input'),   
    beforeSend: function() {
        var img = '<?php echo $text_wait; ?>';
        $('#authorize_button').attr('disabled', 'disabled');

        $('#authorize').before('<div class="wait"><img src="catalog/view/theme/default/image/loading_1.gif" alt="" /> ' + img + '</div>');
        alert('Start');
    },
    success: function(data) {
        if (data.error) {
            alert('errors...');
            alert(data.error);

            $('#authorize_button').attr('disabled', '');
        }

        $('.wait').remove();

        if (data.success) {
            alert('success! It should redirect.');
            location = data.success;
        }
        else {
            alert('it worked... but won\'t redirect...');
            alert(data.success);
        }

    }
});
alert('End');

}

  • 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-23T11:24:19+00:00Added an answer on May 23, 2026 at 11:24 am

    You don’t parse the response. data is still a string.

    Set dataType: 'json' in the $.ajax options.

    Even better if you set the right content type for the response in PHP:

    header('Content-type:  application/json.');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get an autocomplete working and making an Ajax form submission
I'm working on a form validation and submission using jQuery and AJAX. Now, most
Can anyone please help me in finding good tutorials for php/jquery/ajax form submission validating
I am using JQuery to perform form submission through an ajax request. I use
I am using php mysql. First on form submission I run query on mysql
I'm working on a web form where I wish to (after form submission) highlight
Hello I am working with an ajax post function, where I send data and
I'm working with a few pages where javascript executes form submission on page load.
I'm working on validating an image submission form with jQuery. I need it to
I have a form which uses ajax for data submitting. Here is the html:

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.