0

When attempting to include the jquery library via a php require_once() I find that invocations of the .dialog() component of JQuery UI produce an error message:

$("#dialog").dialog is not a function

This seemed strange to me as upon inspecting the DOM I see that the expected html tag is rendered namely:

<link rel="stylesheet" href="/scripts/css/smoothness/jquery-ui-1.8.17.custom.css" type="text/css" />

does anyone know why including the html fragment via php's require_once/include_once would cause this problem?

xenador
  • 211
  • 4
  • 15

1 Answers1

2

A server-side php's require_once/include_once has ABSOLUTELY. NOTHING. TO DO with whatever HTML issues on the client side.

This is most basic rule a web-developer have to learn.

You have to find out a client side issue and fix it.

Always treat any HTML/JS outputted via PHP as native HTML/JS.
There is no difference on the client side.

The algorithm of spotting down the problem is always the same:

  1. Create a clean client-based code with no PHP at all.
  2. Make it work
  3. Let PHP output this code.
  4. If something goes wrong - COMPARE THE CODES. Find out the differencies.
  5. Correct them.
Your Common Sense
  • 156,878
  • 40
  • 214
  • 345