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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:11:15+00:00 2026-06-17T10:11:15+00:00

I have the following ajax call function update_ledger_amount(id) { $.ajax({ type: POST, url: /ledgeritems/UpdateAmount,

  • 0

I have the following ajax call

function update_ledger_amount(id) {
    $.ajax({
        type: "POST",
        url: "/ledgeritems/UpdateAmount",
        data: "Id=" + id + "&Amount=" + $('#ledger_edit_amount_input_' + id).val(),
        success: function (str) {
            var result = str.split('|');
            alert(str);
            if (result[0] == 'success') {
                set_display_message('Item updated', 'success');
                load_ledger_month($('#BankAccountId').val(), $('#StartDate').val());
            }
            else {
                alert('bad');
                set_display_message(result[1], 'error');
            }
        },
        error: function (request, status, error) {
            alert(error);
        }
    });
}

The problem I’m having is that I get no alerts on success or error. Watching the traffic via firebug I can see the response is a simple

success

I believe the problem could have to do with the content-type of the response, it shows as text/javascript. I’m thinking maybe I need to do something different to handle that content type.

  • 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-17T10:11:16+00:00Added an answer on June 17, 2026 at 10:11 am

    use dataType as json and send the response as json in your controller(php).. you can do that by …echo json_encode(array('success'=>'success'))

    JQUERY

    $.ajax({
        type: "POST",
        url: "/ledgeritems/UpdateAmount",
        data: "Id=" + id + "&Amount=" + $('#ledger_edit_amount_input_' + id).val(),
        dataType:'json',
        success: function (str) {
            alert(str.success);  //in mycase.. you can do your stuff here
            /*var result = str.split('|');
            alert(str);
            if (result[0] == 'success') {
                set_display_message('Item updated', 'success');
                load_ledger_month($('#BankAccountId').val(), $('#StartDate').val());
            }
            else {
                alert('bad');
                set_display_message(result[1], 'error');
            }*/
        },
        error: function (request, status, error) {
            alert(error);
        }
    });
    

    PHP

    .....
    echo json_encode(array('success'=>'success'));
    

    this sends success as json and you can get that in success function of ajax

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

Sidebar

Related Questions

I have a simple ajax call: $.ajax({url: my_url_here, dataType: 'text', success: function(data, textStatus) {
The problem is the following. We have lots of ajax call via $.ajax function.
I have the following code to make a jsonp call. var contacts; $.ajax({ url:
I have the following code: $.ajax({ async: false, url: 'chart_data.php', data: {'option':'high', 'id':id}, dataType:
I have the following code: $.ajax({ type: 'GET', url: 'index.php?route=checkout/onepagecheckout/getpaypaldata', dataType: 'json', success: function(json)
I have the following jQuery $.ajax({ type: GET, url: http://f.cl.ly/items/0i1V1L1k2F440L1m2Y0G/pointdata.xml, dataType: xml, success: parseXml
I have the following simple jquery snippet $(document).ready(function () { $.ajax({ url:myjson.json, dataType: 'json',
I have the following ajax call var prev_sibling = $(this).prev().attr(value); var next_sibling = $(this).next().attr(value);
i have the following javascript to post a form through ajax without refreshing the
In my JS I have the following ajax call, that bind the resulting json

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.