Solved

open jquery dialog with php / open javascript function with php

Posted on 2010-09-16
4
1,104 Views
Last Modified: 2012-05-10
Hi!

i want a piece of php code to check what type of browser someone is using and make a jquery dialog open if they use MIE.

The dialog works, the php browser check-code works, but i cant get the php-code to open the jQuery dialog window..
What am i doing wrong?

here are the codes i'm using:

thanks!
BROWSER CHECK AND OPEN DIALOG:

<?  
ini_set('display_errors', 'On');
error_reporting(E_ALL);

    if (isset($_SERVER['HTTP_USER_AGENT']) && 
    (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false))
       echo "<script type=\"text/javascript\">IEuser();</script>";
    else
        echo "Yes, you're not using IE!<br><br>";
?>

Open in new window

OPEN DIALOG:

<script type="text/javascript">
function IEuser() { 
        $('#dialog').dialog('open');
};
</script>

Open in new window

0
Comment
Question by:peps03
  • 2
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
jrm213jrm213 earned 500 total points
ID: 33692270
It might be calling it before everything is loaded,

try the following snippet:


<?  
ini_set('display_errors', 'On');
error_reporting(E_ALL);

    if (isset($_SERVER['HTTP_USER_AGENT']) && 
    (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false))
       echo "<script type=\"text/javascript\">$(document).ready(function (){IEuser();});</script>";
    else
        echo "Yes, you're not using IE!<br><br>";
?>

Open in new window

0
 

Author Comment

by:peps03
ID: 33692408
thanks for your reply jrm!

it isn't opening the dialog. instead, i get this error from ie:

Message: Object expected
Line: 65 ===<script type="text/javascript">$(document).ready(function (){IEuser();});</script>
Char: 31
Code: 0
URI: http://localhost/pepijnniesten.nl/index2.php


0
 
LVL 17

Expert Comment

by:jrm213jrm213
ID: 33692544
Is it all versions of IE or just IE6?
Try removing the "type" from your <script> tags, especially for including jquery.

<script language=”javascript” src=”your-path-to-jquery-version.js”></script>
0
 

Author Comment

by:peps03
ID: 33692652
Thanks JRM, your first post was actually working!

I had a typo in my javascript function.. "IEuser"

Thank you very much!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question