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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:55:20+00:00 2026-06-04T13:55:20+00:00

i have a page , and when the page is started i get data

  • 0

i have a page , and when the page is started i get data using php like this

<?php $data = $this->data;?>

and then i want to put that data on the select tags , i mean the select tags will be defined when the page is opened and without any click from the user, i thing this will be like this

$(document).ready(function(){
  $("#Id").val(data);
});

but my problems is that the jQuery function is on another file , i mean not on the html file , so how can i send that data i got from php on html to jQuery file

i have html page that used php to get some data

i have js file , i want to use that data on

if i can’t explain my problem , tell me to put the code

some code

html

<?php

    $questionInfo = $this->questionInfo->fetch();
    ?>
    <li>
                <label>Type</label>
                <select  name="type"class="TypeSelector"></select>
                <span class="errorMessage"></span>
    </li>

jQuery

 $.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);
                    $('.TypeSelector').val("<?php echo $questionInfo['typeName']; ?>");
                }
            });

on jQuery , check the last line of my code
that is what i want to do , but questionInfo is not identified

I CAN”T USE JS ON MY HTML PAGE , BECAUSE ALL MY WEBSITE HAVE THE SAME HEADER AND SO EVERY PAGE STARTS FROM THE BODY“ , NOT FROM “

  • 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-04T13:55:21+00:00Added an answer on June 4, 2026 at 1:55 pm

    According to you edit:

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

    JS code:

    var typeName = '<?php echo $questionInfo["typeName"];?>';
    

    and last line of your code:

    $('.TypeSelector').val(typeName);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this script loaded on a page: (function() { window.alert('bookmarklet started'); function AjaxSuccess(data,
I just started using SimpleXML to get a feed and display data from that
I have just started a project that involves me sending data using POST in
I have a Node.js app using Express that stores data in a mongoDB (locally).
I have page, i can contact directly without any problems. http://www.mysite.com/app_dev.php/comments/22 the page shows
I have a website that does not have page refreshes when the visitor navigates
I have a page that takes a few minutes to run. When I set
in my PHP web application,I have a dataentry form where users will enter data
Basically, I have populated a dropdown list using php from a database on a
I hope that title makes sense.... Basically I created PHP script to take data

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.