Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

open jquery dialog with php / open javascript function with php

Posted on 2010-09-16
4
Medium Priority
?
1,109 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
jrm213jrm213 earned 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

604 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