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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:47:59+00:00 2026-05-21T08:47:59+00:00

The work flow: user click the button, a dialog box opens with a search

  • 0

The work flow:
user click the button, a dialog box opens with a search form. An ajax post request is sent to the server, and get a json response. I get the callback on success handler. Now two issues.

  1. the dialog closes upon success callback (successFn). I get the json response in the success call back, and I want the user to see the result and press close button to terminate the dialog,.

    1. Soon after the dialog closes, a get request is sent to server. After closing the dialog by itself, the url is like http://localhost:8080/search?query= . I do not send any GET request explicitly

    jQuery(document).ready( function(){
    jQuery(“#myButton”).click( showDialog );

            $myWindow = jQuery('#myDiv');
    
            $myWindow.dialog({ width: 400, autoOpen:false, title:'Hello World',
                    overlay: { opacity: 0.5, background: 'black'},  
                    modal: true,    
                    /*open: function (type, data) {
                        // include modal into form
                        $(this).parent().appendTo($("form:first"));
                    },      */          
                    buttons: {
                        "Submit Form": function() { $('form#myform').submit();},
                        "Cancel": function() {$(this).dialog("close");}
                            }
                    });
            });            
    
    
    var showDialog = function() {
        $myWindow.show(); 
        $myWindow.dialog("open");    
        }
    
    var closeDialog = function() {
        $myWindow.dialog("close");
    }
    
    var successFn = function (response) {   
            var obj = JSON.parse(response); 
            $("#result").html('').html(obj.name);
    }
    var errorFn =  function (xhr, ajaxOptions, thrownError){
                $("#myform").parent().html('').html(xhr.statusText);
                }
    var query = $("input#query").val(); 
    var dataString = 'query='+ query ;  
    
    $('form#myform').submit(function(){
        $.ajax({
            type: 'post',
            dataType: 'json',
            url: '/search',
            async: false,
            data: $("#myform").serialize(),
            success: successFn,
            error: errorFn
        });
    });     
    

  • 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-21T08:48:00+00:00Added an answer on May 21, 2026 at 8:48 am

    It would be a good idea to add method="post" to your form to avoid any accidental GET data being sent.

    Adding return false; to the success function may stop the dialog from closing. I’ll test this if I can.

    Edit: also check that all your code is inside jQuery(document).ready( function(){

    Hope that helps!

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

Sidebar

Related Questions

My normal work flow to create a new repository with subversion is to create
I have to present some 'process' or 'flow' of the application at work on
The current workflow is as follows: user clicks a button sends a Loader to
I have some workflow to work with in Worflow foundation. I need to follow
In Sharepoint designer's workflow editor I wish to retrieve the username/name of the work
The main flow of my project is controlled by a UINavigationController. I need to
How to edit a Word Document (.docx) stored in a SQL Server Table? Here
The workflow is like this: I receive a scan of a coupon with data
Currently my workflow with Emacs when I am coding in C or C++ involves
i have created a workflow activity that do give the item creater of a

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.