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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:33:31+00:00 2026-05-13T15:33:31+00:00

Basically, I referred to some sources, and found this: Yah, that’s easy, just create

  • 0

Basically, I referred to some sources, and found this:

“Yah, that’s easy, just create a div on your page, put the form in there, and make that your dialog.” Well that’s great, but what if you’re trying to achieve maximum compatibility? What happens if for whatever reason a user has JavaScript disabled in their browser? Suddenly that entire ‘add’ functionality is lost.”

I downloaded the original script to modify and try. After modification, not working.

What I want to achieve is as follow:

onclick to popup dialog-form (ok),

I need to pass in value into the new.php for internal data query.

When click the save button on the form, I need to php echo the value into $.ajax success:

At the same time show progress bar loading screen, until user verification finish and popup closed.

Second thing is what else I missed out at the $.getJSON the results won’t show at #profile

Full code reference:

index.php

<head>
<title>jQuery AJAX-Enabled Forms in Modal Dialog</title>
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.7.2.custom.min.js"></script>

<script language="javascript" type="text/javascript">

$(document).ready(dialogForms);

function dialogForms() {

   $('a.dialog-form').click(function() {

                   //how to pass in additional parameter value into new.php for local processing?

   var a = $(this);

   $.get(a.attr('href'),function(resp){

     var dialog = $('<div>').attr('id','formDialog').html($(resp).find('form:first').parent('div').html());
     $('body').append(dialog);
     dialog.find(':submit').hide();

     dialog.dialog({
      title: a.attr('title') ? a.attr('title') : '',
      modal: true,
      buttons: {
       'Save': function() {submitFormWithAjax($(this).find('form'));},
       'Cancel': function() {$(this).dialog('close');}
      },
      close: function() {$(this).remove();},
      width: 'auto'
      });

   }, 'html');

   return false;
   });
}


function submitFormWithAjax(form) 
{
  form = $(form);

 //if dataType: 'script' then must echo output in javascript alert format

  $.ajax({
  url: form.attr('action'),
  data: form.serialize(),
  type: (form.attr('method')),
  dataType: 'script'

  //after adding the commented line below, the popup not working, instead it will go directly to new.php
  //suspect due to dataType and form method thing.
  /*        
  beforeSend: function(){ 
   //the modal popup show loading bar
  },

  error: function(XMLHttpRequest, textStatus, errorThrown) {

  },

  success:  function(output) {       

   if(output==1){   //login success
                            //close modal popup 
    window.reload(); //to detect SESSION['user'] stored inside php. If exist, then prefill this master form with user details
   }
   else{
                            //put message into modal popup as div, message is something like invalid login...

   }

  },

  complete: function(){ }
   //close modal popup          
  });
  */

  });

  return false;
}




</script>


<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/cupertino/jquery-ui.css" rel="stylesheet" />
</head>

<body>
<a href="new.php" class="dialog-form" title="login">Existing user login here</a>

<div id="profile">
<span id="ip"></span>
<span id="country"></span>
</div>

</body>

</html>
  • 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-13T15:33:32+00:00Added an answer on May 13, 2026 at 3:33 pm

    To pass parameter, use this format:

    $.get(URL, {
        PARAM
      },
      function(resp) {});
    

    PARAM is in form of key: value, key2: value2.

    To submit form, consider using malsup’s jQuery form plugins.

    To use AJAX, the URL must be in same domain. So using getJSON to other domain, such as iplocationtools.com from other domain will failed. There are several way to do cross domain AJAX.

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

Sidebar

Ask A Question

Stats

  • Questions 310k
  • Answers 310k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you want to investigate the preprocessor choice ( my… May 13, 2026 at 10:05 pm
  • Editorial Team
    Editorial Team added an answer This is for VS2008, but should apply just as well… May 13, 2026 at 10:05 pm
  • Editorial Team
    Editorial Team added an answer You can include the script file directly in your page/master… May 13, 2026 at 10:05 pm

Related Questions

I'm working on a fairly large project for a trading company in Philadelphia. The
We have our own glue-layer-code-thingamajig that allows us to host the .NET runtime in
I have a scenario which is not easy to explain, but I am sure
I was wondering if there was a way to send a referer with a
I've come across a design pattern that's been referred to as a Handler Pattern,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.