?
Solved

dialog box wont open a  second time

Posted on 2014-08-10
14
Medium Priority
?
188 Views
Last Modified: 2014-10-08
i have
$(document).ready(function() {

    $('#example1').bind('click', function(e) {
        e.preventDefault();
        new $.Zebra_Dialog('<strong>Zebra_Dialog</strong>, a small, compact and highly configurable dialog box plugin for jQuery');
    });

    $('#profile').bind('click', function(e) {
        e.preventDefault();
        new $.Zebra_Dialog('<strong>Some dummy content:</strong><br><br>', {
            source: {'ajax': '../j_social/user_profile.php'},
            width: 800,
            show_close_button: false,
            animation_speed_show: 375,
            animation_speed_hide: 375,
            title:  'Profile External content loaded via AJAX'
        });
         return false;
    });



});

Open in new window


im getting an error of
Uncaught TypeError: undefined is not a function 

Open in new window

for line 10 thats the  new $.Zebra_Dialog line
what am i doing wrong?? how do i fix the ability to open a second time please?
note: again the first round works fine. able to open it and close it fine

thank you in advance for any code or help you may provide.
Johnny
0
Comment
Question by:Johnny
  • 9
  • 5
14 Comments
 
LVL 83

Assisted Solution

by:leakim971
leakim971 earned 2000 total points
ID: 40252254
please provide a link to your page as it work fine here : http://jsfiddle.net/ay5gp5sh/1/
0
 

Author Comment

by:Johnny
ID: 40252261
@leakim971
thx for the reply, and the jsfiddle example.

its not possible for me to display the code on my page its user locked for one and its a private project.

is there anything i can do to get more info on my end?
it works fine in the example i downloaded(i just checked) so this leads me to believe there maybe a conflict some place. im not sure how to track that down if so.

i would really like to get this working as this is exactly what i need in this project.

OH totally forgot im using this as the dialog script
http://stefangabos.ro/jquery/zebra-dialog/
0
 
LVL 83

Expert Comment

by:leakim971
ID: 40252272
check for error when you click the first time
start from scratch
0
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.

 

Author Comment

by:Johnny
ID: 40252280
ok i redid it some i took the js file i has as i had two doc ready's - and i combined them in the main index.php file.

this fixed the example1 pop up. it now cycles fine

my profile id one still has issues and works fine no errors on the first run the second time you click on the link it gives the error
heres the screen shot
chromes screen shot in counsolechromes screen shot in console

would it be better if i did a close and destroy in the jquery call? (i saw that code someplace but forgot where.
or can i do anything else?
im open to any suggestions to try
0
 

Author Comment

by:Johnny
ID: 40252281
upon reading this ill bet this s whats happening its destroying it
external link removed
0
 
LVL 83

Expert Comment

by:leakim971
ID: 40252290
put all your scripts in the head section, look like you're loading page and script using ajax
be sure to load the script one time and not just thinking each script will do the work for you
0
 

Author Comment

by:Johnny
ID: 40252298
@leakim971
how can i assign it a var and then use that var to close the dialog please, id have to use new too right
0
 

Author Comment

by:Johnny
ID: 40252309
oh come on now this is getting stupid.

        var dialog1 = new $.Zebra_Dialog('<strong>Some dummy content:</strong><br><br>', {
            source: {'ajax': '../j_social/user_profile.php'},
            width: 800,
            show_close_button: false,
            animation_speed_show: 375,
            animation_speed_hide: 375,
            title:  'Profile External content loaded via AJAX',
            close: function( event, ui ) {
			    //Now call "close"
			    $(this).dialog('close');
		}
        });
    $('#profile').bind('click', function(e) {
        e.preventDefault();
        $dialog1.dialog("open");
    });

Open in new window

now its saying
Uncaught ReferenceError: $dialog1 is not defined

also its opening as the page loads, i assume this is from its assigning the var and running, not even sure if this i the right way right now im doing trial and error to fix this dumb problem
0
 

Author Comment

by:Johnny
ID: 40252344
it seams to me that the example1 dialog works fine and cycles reopens multi times so the other parts work.
when i do my profile one it only opens once does this mean its being destroyed and cant come back??
sorry im getting confused as to how close and destroy work and im perplexed as the example1 works fine and the profile one does not
0
 
LVL 83

Assisted Solution

by:leakim971
leakim971 earned 2000 total points
ID: 40252347
assign it ? << it >> ? the dialog box ? I don't know.
di you try :

var a = new $.Zebra_Dialog('....
0
 

Accepted Solution

by:
Johnny earned 0 total points
ID: 40252351
i found the problem
i was calling an actual stand alone page with reloading jquery and page headers etc.
i took out the ajax call and i worked fine i then uncommitted it and took out all the header and body tags(and stuff in head and it works like a charm now.. go figure

hope this helps someone else and they save the hours i wasted on something stupid
0
 

Author Comment

by:Johnny
ID: 40252352
@leakim971
would you mind if i gave you 100 points as assisted, because your fiddle made me think more about it and show me it worked stand alone?? Id like to accept my "i found the problem" as the solution.

thanks for the help non the less im very grateful for the ball rolling.
0
 
LVL 83

Expert Comment

by:leakim971
ID: 40360148
'welcome
0
 

Author Closing Comment

by:Johnny
ID: 40367947
Thanks for the help - i gave 100 points for getting the ball rolling as i defined in my ask post if this was ok, i accepted my answer as solution.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

862 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