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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:02:10+00:00 2026-06-07T12:02:10+00:00

I am trying to add an ajax function to a script that does 2

  • 0

I am trying to add an ajax function to a script that does 2 things essentially:

Step 1: Determine if it needs to search for users or create a new one
Step 2: Based on selection 1, it will either go to the selected script (that part works) or call a new function (that part doesn’t work, yet). Now, I know the 2nd function itself works perfectly as I called it directly in the anchor tag and had no issues, so it has to be in how I am trying to all it witin the function itself. here’s what I have so far:

function changecm(){
var txt = 'Select An Option To Continue:<br>
<input type="radio" name="type" id="type" value="search" style="font-size:22px;"><br>
<input type="radio" name="type" id="type" value="create" style="font-size:22px;">';

$.prompt(txt,{ 
    buttons:{Confirm:true, Cancel:false},
    submit: function(v,m,f){
        var flag = true;
        if (v) { }
        return flag;
    },
    callback: function(v,m,f){

        if(v){      
        var type = f.type;
            if(type == 'create'){
                $.post('changecm',{type:type},
                       function(data){
                       $("div#customer").html(data);
                       }
                );
            }
            else{
            function(changecmnow);
            }
        }
    }
});

}

That’s function 1. Here’s function 2:

function changecmnow(){
var txt = 'Enter the first name, last name, or telephone number of the customer to limit your results:<br>
<input type="text" name="terms" id="terms" style="font-size:22px; width:400px;">';

$.prompt(txt,{ 
    buttons:{Confirm:true, Cancel:false},
    submit: function(v,m,f){
        var flag = true;
        if (v) { }
        return flag;
    },
    callback: function(v,m,f){

        if(v){      
        var terms = f.terms;
            $.post('changecm',{terms:terms},
                   function(data){
                   $("div#customer").html(data);
                   }
            );
        }
    }
});

}

  • 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-07T12:02:13+00:00Added an answer on June 7, 2026 at 12:02 pm

    if you just want to invoke the function, why not just

    else { changecmnow();
    }

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

Sidebar

Related Questions

I've been trying to add some AJAX/jQuery script to my site so that only
I am trying to create a simple ajax grid that allows me to add
Currently trying at add ajax to a site, after much reading I discovered that
Hey there, new to AJAX, JS.. Im trying to add to a Javascript/Ajax search
I am trying to call a PHP function using AJAX. Below is the script
I am trying to add validation to a form that is submitted by ajax,
I'm trying to add details to a database by using ajax and table dynamic
I'm trying to add some jQuery stuff to Gmail using a GreaseMonkey script. Adding
I am trying to add a click event on the element that is return
So, I'm trying to make cross-site AJAX request from my own script to the

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.