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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:31:53+00:00 2026-06-04T18:31:53+00:00

i want to make an edit page, when the user go to a question

  • 0

i want to make an edit page, when the user go to a question (i have a question website) he will have a choice to edit that question , and when the user click to edit question , i want to get all the information about that question from database and put it in an edit page , i did that and it works good with all information , but i have a problems and it is :

on my edit page i have many drop down lists and each drop down get its options from database using ajax with jquery

my problem is in the last 4 drop down lists

the first drop down list is what the question about
,it has 3 options place , cell ,general
the second drop down list is what the city that question about , it has 14 values
the third drop down list is what the cell the question about and its options comes depends on the second drop down list options , i mean if the user set a city on the second drop down list , the cell drop down list will have many options , but if he changed the city , the user will have new options in the cell drop down list
,the forth drop down is what the place that the question about
so when i open the edit page i have to fill those drop down list with its value , each one according to the previous drop down list,
,i did that , but my problems is the page works good after 4 or 5 refresh , not from the beginning ,i mean i have to refresh the page 4 or 5 times to get the good results , because on the first refresh the drop down list still empty , but i alert the results each refresh and i got the expected results

SOME OF HTML

<?php
  $questionInfo = $this->questionInfo->fetch();
  $questionPlaceCountry = $this->questionPlaceCountry->fetch();
  $questionCell = $this->questionCell;
?>

<script type="text/javascript">
  var typeName= '<?php echo $questionInfo["typeName"]; ?>';
  var place = '<?php echo $questionPlaceCountry["placeName"]; ?>';
  var country = '<?php echo $questionPlaceCountry["countryName"]; ?>';
  var cell = '<?php echo $questionCell; ?>';
</script>

<li>
  <label>About</label>
  <select name="about"id="aqAboutQuestion"></select>
  <span class="errorMessage"></span>
  <p id="aqCoutryAboutQuestion">
    <label>Select City</label>
    <select name="city"class="CountrySelector1"></select>
  </p>
  <p id="aqCellAboutQuestion">
    <label>Select Cell</label>
    <select name="cell"></select>
    <span class="errorMessage"></span>
  </p>
  <p id="aqPlaceAboutQuestion">
    <label>Select Place</label>
    <select name="place"></select>
    <span class="errorMessage"></span>
  </p>
</li>

SOME OF JQUERY CODE

$.getJSON(
  "http://localhost/Mar7ba/Type/getAllTypes/TRUE",
  function(data){

    var options = '';
    options+="<option>Select Type</option>";

    for(var i=0;i<data.length;i++){
      options += "<option value='"+data[i]+"'>"+data[i]+"</option>";
    }

    if($("#addPlace #apTypeSelect").length){
      $("#addPlace #apTypeSelect").html(options);
    }

    if($('.TypeSelector').length){

      $('.TypeSelector').html(options);
      if("#editOneQuestion"){

        $('.TypeSelector').val(typeName);
        if(place!=null){

          $("#aqCoutryAboutQuestion").css("display","block");
          $("#aqCellAboutQuestion").css("display","block");
          $("#aqPlaceAboutQuestion").css("display","block");
          $("#aqAboutQuestion").val("Place");

          $("#aqCoutryAboutQuestion select").val(country);

          $.getJSON(
            "http://localhost/Mar7ba/Cell/getCellsInCity/"+country+"/TRUE",
            function(data1) {

              var optoins1 = '';
                  optoins1+="<option>Select Cell</option>";

              for(var i=0;i<data1.length;i++){
                optoins1+="<option value='"+data1[i]+"'>"+data1[i]+"</option>";
              }

              $("#aqCellAboutQuestion select").html(optoins1);
              $("#aqCellAboutQuestion select").val(cell);
          });

          $.getJSON(
            "http://localhost/Mar7ba/Place/givePlacesInCell/"+cell+"/TRUE",
            function(data2){

              var options2 ='';
              options2+="<option>Select Place</option>";
              for(var i = 0 ; i < data.length;i++){
                options2+="<option value='"+data2[i]+"'>"+data2[i]+"</option>";
              }
              $("#aqPlaceAboutQuestion select").html(options2);
              $("#aqPlaceAboutQuestion select").val(place);
          });
        }
      }
    }
});

would you help me and tell me what am i doing wrong ?

  • 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-04T18:31:54+00:00Added an answer on June 4, 2026 at 6:31 pm

    the problem is that because probably you are using

    $(document).ready()
    

    but you have to use:

    $(windows).load()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make a page for a website that will let the user
I want to make a language selection dropdown in a site user edit/create page.
I want to make a edit profile form for my website. My idea is
Edit For simplicity: I just want to make the most basic possible cursor that
I have a UserControl that I want to include in a page multiple times
I use Zend framework to build the forms, I want to make the edit
I want make interactive application where user launches it and can do various task
I have style sheet with a class name changebackgroundcolor i want make change in
I want code in a php5 page be executed after all of the page
and thanks for taking the time to read my question. We will have visitors

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.