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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:04:15+00:00 2026-05-18T00:04:15+00:00

I have this ajax call at the moment: $.ajax({ url: misc/sendPM.php, type: POST, data:

  • 0

I have this ajax call at the moment:

$.ajax({
    url: "misc/sendPM.php",
    type: "POST",
    data: data,

    success: function(stuff) {

        if (typeof stuff == "object") {
            var err = confirm(stuff.error);
            if (err) {
                alert('You pressed OK'); // MAKE AJAX CALL HERE HERE HERE HERE
            } else {
                $("#pmResponse").text("Mottagare saknas!").show().fadeOut(4500);
                $('#sendPM_btn').attr('disabled', false);
                $('#txt').attr('readonly', false);
                $('#title').attr('readonly', false);
            }
        } else {

            $(stuff).prependTo('#PrivateMessages').fadeIn(1000);
            $('#txt').val("");

            $("#pmResponse").text("Skickat!").show().fadeOut(4500);
            $('#sendPM_btn').attr('disabled', false);
            $('#txt').attr('readonly', false);
            $('#title').attr('readonly', false);
        }
    }
});

I am making an “Did you mean?” If the user hasn’t typed in right name for the recipient. The “did you mean name” comes in a confirm, so you could press OK or Cancel -> to type again a new name.

If you press ok right now, you only get a alert (see above code). But what I want to do when you press OK is make a change in ‘recipient’ data name, and send back the same data. Is this possible? How?

So conclusion what I am doing now is:

Sending request to sendPM.php with
data, sendPM.php grabs the data and if
it finds the recipient name is
unclear(eg. Megan F) then it returns
JSON “error” with: Did you mean Megan
Fox?, the $.ajax on success grabs it,
and make it as a confirm box. If you
press OK on the confirm box(if you did
mean megan fox), then it should send
back “Megan Fox” to sendPM.php along
with all the previous data,
In order to complete the process fully.

Is there a better way to do this?

If no, how can I then send back “megan fox” to sendPM.php along with the previous data in order to complete the process fully?

  • 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-18T00:04:15+00:00Added an answer on May 18, 2026 at 12:04 am

    Make them into functions instead.

    function sendRequest(data) {
        $.ajax({
            ...
            data: data
            success: process
        });
    }
    
    function process(stuff) {
        ...
        if(err && confirm("Did you mean " + stuff.suggestion + "?")) {
            sendRequest([make your new data here]);
        }
        ...        
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code inside the success function of a jQuery ajax call success:
Hei guys i have this JQuery Ajax call from my view and it looks
On my website I use a long polling jquery ajax function. This ajax call
I'm using an ajax call to do a minor calculation then return the value
If I have 4 tabs where the first 2 are loaded with ajax and
I have this json {suggestions:[M.I.A.,M.,Mindless Self Indulgence,The Cure,Telefon Tel Aviv,M,J. Ralph,Jason Mraz,Carbon Based Lifeforms,Cycle
I'm just starting to look in to caching to improve performance and have a
I am fairly new to Jquery and javascript and have jumped in head first
I have a simple form (textbox, submit button) which is wrapped in an update
Is is possible to update an image on an HTML page using the response

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.