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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:27:40+00:00 2026-06-08T02:27:40+00:00

In my php page I got a jquery script to open a dialog window.

  • 0

In my php page I got a jquery script to open a dialog window. The code is as

<script type="text/javascript">
            $(document).ready(function() {
                var $loading = $('<img src="loading.gif" alt="loading" class="loading">');

                $('#data-specs a').each(function() {
                    var $dialog = $('<div></div>')
                        .append($loading.clone());

                    var $link = $(this).one('click', function() {
                        $dialog

                            .load($link.attr('href'))
                            .dialog({
                                title: '<?php echo $_GET["indQ"];?>',
                                modal: true,
                                width: 500,
                                height: 300,
                                minHeight: 300,
                                maxHeight: 600,
                                minWidth: 500,
                                maxWidth: 800
                                });

                            $link.click(function() {
                            $dialog.dialog('open');

                            return false;
                        });

                        return false;
                    });
                });

                $('#dav').val(getURLParameter('davQ'));

                $('#pathogen').val(getURLParameter('pathogenQ'));

                $('#topicF').val(getURLParameter('topicQ'));

                $('#ind').val(getURLParameter('indQ'));

                $('#subind').val(getURLParameter('subindQ'));

                $(".selfont").change(function (event) {
                        window.location = '?davQ=' + $('#dav').val() + '&pathogenQ=' + $('#pathogen').val() + '&topicQ=' + $('#topicF').val() + '&indQ=' + encodeURIComponent($('#ind').val()) + '&subindQ=' + encodeURIComponent($('#subind').val());
                });

                function getURLParameter(name) {
                         return decodeURIComponent((RegExp(name + '=' + '(.+?)(&|$)').exec(location.search) || [, null])[1]);
                }

            });
    </script>

The data is in a table with id=’data-specs’. And it works well. Recently I added a dropdown box with values to sort this table using an ajax script and it works too. But the problem is after this ajax call, when I click the link to open dialog window its getting opened in the parent window itself, if we press the browser back button and then click the link it will open the dialog window with no errors !! How can I make this correct even after the sort is done using ajax ? please gave me some solutions. My ajax code to sort is as shown below

function ajaxFunction(){

    //to keep selection in countryList - GP
    var ref = document.getElementById('countryRF');
    for(i=0; i<ref.options.length; i++)
    ref.options[i].selected = true;


    var ajaxRequest;  // The variable that makes Ajax possible!

    try{
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
    } catch (e){
        // Internet Explorer Browsers
        try{
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try{
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e){
                // Something went wrong
                alert("Your browser broke!");
                return false;
            }
        }
    }
    // Create a function that will receive data sent from the server
    ajaxRequest.onreadystatechange = function(){
        if(ajaxRequest.readyState == 4){
            //document.myForm.time.value = ajaxRequest.responseText;
            document.getElementById("result").innerHTML=ajaxRequest.responseText

        }
    }

    var dav = document.getElementById('dav').value;
    var pathogen = document.getElementById('pathogen').value;
    var topicF = document.getElementById('topicF').value;
    var ind = document.getElementById('ind').value;
    var subind = document.getElementById('subind').value;
    var selObj = document.getElementById('countryRF');
    var cnty = loopSelected(selObj).join('~');  // join array into a string
    var sortby = document.getElementById('sortby').value;

    var queryString = "?dav=" + dav + "&pathogen=" + pathogen + "&topicF=" + topicF + "&ind=" + encodeURIComponent(ind) + "&subind=" + encodeURIComponent(subind) + "&cnty=" + encodeURIComponent(cnty) + "&sortby=" + sortby;
    ajaxRequest.open("GET", "sortbyD.php" + queryString, true);
    ajaxRequest.send(null);
    return false;
}

Please help me to slve this issue..

  • 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-08T02:27:41+00:00Added an answer on June 8, 2026 at 2:27 am

    While the page is load first time the dialog box event are bound with element, After ajax you need to again bound the dialog box event with .bind() function

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

Sidebar

Related Questions

I've got a jQuery function that retrieves a JSON response from a PHP page.
I have the following script inside a HTML page: <script> function Test(){ alert(i got
Jquery puzzle I've got a php script that returns the name of random jpg
I've got a JavaScript function which gets executed when the page loads, and then
I am exporting data table from php page to pdf I got the page
I've got a PHP page that parses an XML file with SimpleXml, then passes
I have a dynamic drop down box which calls another PHP page. I've got
I've got a an AJAX page request that uses a php file designed to
I have a PHP page where i want to open a file on a
acctually i am not familier much with jquery.. i got this jquery script this

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.