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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:10:05+00:00 2026-06-15T05:10:05+00:00

I am using AJAX in my dynamic website. Instead of reloading a whole page,

  • 0

I am using AJAX in my dynamic website. Instead of reloading a whole page, I used AJAX to request PHP file, and change the content of the page.

Is it OK to take away doctype and tags from those PHP files that requested by AJAX?
Will I get any errors in future, if I leave doctype and tags from PHP…

Thank.

  • 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-15T05:10:07+00:00Added an answer on June 15, 2026 at 5:10 am

    Scenario 1

    If the “page” is actually a fragment that is being inserted dynamically into a complete document, you don’t need those tags (in fact, they would be invalid).

    <!DOCTYPE html>
    <head></head>
    <body>
    
        <div></div>
        <!-- fine to insert a fragment here -->
    </body>
    </html>
    

    Scenario 2

    If the page needs to stand alone, it must be complete and valid. Even if it displays correctly, it has the potential for major issues.

    Scenario 3

    If the PHP page is just serving data (e.g. JSON) in response to an AJAX request, it doesn’t need any HTML markup at all (@Sean Dunwoody demonstrates this).

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

Sidebar

Related Questions

I am trying to create a dynamic 'page' listing for threads/comments using AJAX. in
I am building a website using php+mysql. I have a registration page and its
I'm creating a website where I'm doing ajax requests to load some dynamic content
How do you do dynamic refresh of a single div tab using php/ajax and
In a jQuery Mobile application, I'm using Ajax to load a page with dynamic
I have a php page which supports arabic text properly. I am using ajax
I'm using jQuery ajax to load content into my web page. When a user
I'm trying to add details to a database by using ajax and table dynamic
We are using the Dynamic Script Tag with JsonP mechanism to achieve cross-domain Ajax
I am using System.Linq.Dynamic to do custom where clauses from an ajax call in

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.