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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:46:40+00:00 2026-05-30T19:46:40+00:00

Using jquery dialog I have created a popup box with a form. I am

  • 0

Using jquery dialog I have created a popup box with a form.
I am writing php code and I want to use the least javaScript possible.
I would like to submit the form using php sending $GET variables (I have complex actions with the database to perform).
Is there a way to do this?
My code is:

         $( "#dialog-form" )
            .dialog({
                autoOpen: false,
                title: "Add Images",
                buttons: {"Ok": function() 
                                    //I want to submit a $GET variable }},
                draggable: false,
                resizable: false 
        });

        $("#addImage")
            .click(function() {
            $( "#dialog-form" ).dialog("open");
        });     


//form 
<div id="dialog-form">

    Xml::openElement( 'form', array(
            'action' => $action,
            'method' => 'get')). 
        );  

       Xml::radio('name=addimage', 'value', 'he') . 'Choose from Exisiting'.
           Xml::radio('name=addimage', 'value=go')  . 'Upload Image'
           //I want to have a XML::submit('ok') button to submit the form. I've tried putting this in but it doesn't do anything.                                               
               Xml::closeElement( 'form' );
         </div>
<button id="addImage">Add Image</button>

my complete code:
function fnAddImages(){
global $wgOut, $wgHooks, $wgUser;

 // import addimage javascript and css files
  $wgOut->addScript('<script type="text/javascript" src="extensions/AddImages/addimages.js"></script>');
  $wgOut->addScript('<script type="text/javascript" src="extensions/AddImages/js/jquery-1.7.1.min.js"></script>');
  $wgOut->addScript('<script type="text/javascript" src="extensions/AddImages/js/jquery-ui-1.7.3.custom.min.js"></script>');
  $wgOut->addScript('<link type="text/css" href="extensions/AddImages/css/blitzer/jquery-ui-1.7.3.custom.css" rel="Stylesheet" />');      
  $wgOut->addScript("<style>@import url( extensions/AddImages/style.css);</style>");

  //Add Image button with popup onclick
$wgOut->addScript('<script type="text/javascript"> 
    ( function($) {
        $(document).ready(function() {
        $( "#dialog-form" )
            .dialog({
                autoOpen: false,
                title: "Add Images",
                buttons: {"Okay": function() {$("#dialog-form form").submit(); }},
                //{"Cancel": function() { $(this).dialog("close"); }},
                draggable: false,
                resizable: false 
        });

        $("#addImage")
            .click(function() {
            $( "#dialog-form" ).dialog("open");
        });
        });     

    } ) ( jQuery );

</script>'); 
//form 


$wgOut->addHTML('<div id="dialog-form">'); 


$wgOut->addHTML(
    Xml::openElement( 'form', array(
            'action' => '..' ,
            'method' => 'get')). 
        Xml::hidden( 'wpEditToken', $wgUser->editToken() )
        );  

$wgOut->addHTML( 
             Xml::radio('name=addimage', 'value', 'he') . 'Choose from Exisiting'.
                   "<br />" .
                Xml::radio('name=addimage', 'value=go')  . 'Upload Image'.
                   "<br />" .
                // Xml::submitButton('Ok') .
               Xml::closeElement( 'form' )
            );
$wgOut->addHTML('</div>');
$wgOut->addHTML('<button id="addImage">Add Image</button>');


//retun true to run hook function  
return true;

}

I am running it on a mediawiki site.
I’m trying to create a ‘add image’ button that will give you a radio button form so you can choose to ‘upload your own image’ or ‘existing image’. I need to press ‘ok’ so I can code functions that will pull data from the database or show a new popup box for uploading images.
Thanks for your help.

  • 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-30T19:46:41+00:00Added an answer on May 30, 2026 at 7:46 pm

    I you want to perform an synchronous get request (AJAX):

    Have a look at either get in combination with serialize.

    Something like:

    $.get(theUrl, $("#dialog-form form").serialize());
    

    I’ve added a more complete example here:

    http://jsfiddle.net/3uNyN/1/

    Here’s the essence:

    var form = $("#dialog-form form"); 
    var url = form.attr('action');     // use the action URL of the form
    var data = form.serialize();       // serialize form data to key=value&foo=bar.. form
    $.get(url, data, function(){       // perform asynchronous get request to url
        alert('done');                 // the passed in function is called on success
    });
    

    If you simply want to submit the form synchronously (as if you’d normally press a submit button), simply call

    $("#dialog-form form").submit();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created app using jQuery Mobile and need to get a Dialog box
Morning. I have a form which is rendered inside of a jquery dialog box
Scenario: Using jquery form plugin . The form appears in a dialog, created with
I am using jQuery .dialog() in my code. In dialog i am having Form.
How do I create an edit dialog box using jquery? Let say I have
I am using SimpleModal in jQuery, and I have one confirm dialog. If the
How can I change CSS from javascript . I'm using jQuery-ui Dialog and I
I'm using jquery for modal dialogs. I want to open model dialog from one
I created a page that has a JQuery based dialog using the standard JQuery
How to prompt browser to display open/save dialog box using jquery?

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.