Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-09-2008, 07:02 PM   PM User | #1
maverick83
New to the CF scene

 
Join Date: Sep 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
maverick83 is an unknown quantity at this point
Pop up box in Ajax

Hi

I want to design a pop up in ajax but i am not able to do it

i adopted the following approach first :-
i will post some code below :- it is in HTML ,we can also use mouse over event for this portion<div id="more">
<p>Click for pop up</p>
</div>
what i am currently doing in JS is given below:-// YUE.on("more" , 'click', popupDialog) ; i am decalring this first and then below i am defining the function popupDialpog function popupDialog( e)
Click: {
onClick: {
Popup: {
id: 'static-content' ,
width: '300px',
effect: {effect:YAHOO. widget.Container Effect.FADE, duration: 0.2},
hd: 'Static Content',
bd: '<p>This is a paragraph of text. It starts in the previous sentence. It finishes at this period.</p><p>This is some <strong>bold text</strong> and some <em>italic text</em>.</p>',
ft: ''
}
}
}
}); but when i see the webpage it says "expect string,identifier or number" from the line where the funtion popupDialog is getting started

is this the right way ,looking forward for a favorable response form ur side

regards,
rahul
maverick83 is offline   Reply With Quote
Old 09-09-2008, 07:18 PM   PM User | #2
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
When you post code in forums, please use code tags so it looks nice.

Have you tried to use Firefox with the Firebug extension? That should give you a better error message.

Eric
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 is offline   Reply With Quote
Old 09-10-2008, 03:30 PM   PM User | #3
ohgod
Regular Coder

 
ohgod's Avatar
 
Join Date: Jun 2008
Location: Ohio
Posts: 579
Thanks: 6
Thanked 69 Times in 69 Posts
ohgod is on a distinguished road
if you want some simple, sexy popups:

http://prototype-window.xilinus.com/index.html


some really nice stuff there, VERY easy to use. anymore i figure, why reinvent the wheel?
ohgod is offline   Reply With Quote
Old 02-02-2009, 05:35 PM   PM User | #4
vw98034
Regular Coder

 
vw98034's Avatar
 
Join Date: Feb 2004
Posts: 194
Thanks: 3
Thanked 0 Times in 0 Posts
vw98034 is an unknown quantity at this point
Quote:
Originally Posted by ohgod View Post
if you want some simple, sexy popups:

http://prototype-window.xilinus.com/index.html


some really nice stuff there, VERY easy to use. anymore i figure, why reinvent the wheel?
I used the library with the following code:

Code:
			win = new Window({className: "default", title: "Comments", width:400, height:350, destroyOnClose: true, recenterAuto:false}); 
			win.getContent().update(searchReq.responseText); 
			win.showCenter();
And I have /js/window.js, /js/prototype.js, and default.css in the path. The content is shown up, but not the window itself. I believe that is something wrong with the CSS. I, however, can't find any causes.

What I miss here?
vw98034 is offline   Reply With Quote
Old 02-02-2009, 07:13 PM   PM User | #5
vw98034
Regular Coder

 
vw98034's Avatar
 
Join Date: Feb 2004
Posts: 194
Thanks: 3
Thanked 0 Times in 0 Posts
vw98034 is an unknown quantity at this point
Unhappy

Quote:
Originally Posted by ohgod View Post
if you want some simple, sexy popups:

http://prototype-window.xilinus.com/index.html


some really nice stuff there, VERY easy to use. anymore i figure, why reinvent the wheel?
Based on my test, this library don't work for Ajax at all with IE 7.
vw98034 is offline   Reply With Quote
Old 02-03-2009, 01:55 PM   PM User | #6
ohgod
Regular Coder

 
ohgod's Avatar
 
Join Date: Jun 2008
Location: Ohio
Posts: 579
Thanks: 6
Thanked 69 Times in 69 Posts
ohgod is on a distinguished road
yes it does. i use it all the time. it actually has like 3 ways to work with ajax.... read the documentation.

for easy ajax content try something like:

Code:
win = new Window({title: "Comments", width:400, height:350, destroyOnClose: true, recenterAuto:false });
win.setAjaxContent('./mypage.php');
win.show();
and if you're using default.... you don't need to specify it. that's why it's default :P


if the images\styling still don't show up, your path is probably wrong.

Last edited by ohgod; 02-03-2009 at 02:01 PM..
ohgod is offline   Reply With Quote
Old 02-03-2009, 06:32 PM   PM User | #7
vw98034
Regular Coder

 
vw98034's Avatar
 
Join Date: Feb 2004
Posts: 194
Thanks: 3
Thanked 0 Times in 0 Posts
vw98034 is an unknown quantity at this point
Thanks "Oh God" for your follow-up.

I have tried more than one ways to get the content up on the popup window. The first try is with Dialog as the following:

Code:
		Dialog.alert({url: '../webSiteEntry/getComments.htm?wid=' + wid, options: {method: 'get'}}, {className: "alphacube", width:540, okLabel: "Close"});
The content doesn't show up with IE 7, but FireFox and Safari. And I try the following:
Code:
	function retrieveComments(n){

		if ((searchReq.readyState == 4 || searchReq.readyState == 0) ) {
			searchReq.open("GET", '../webSiteEntry/getComments.htm?wid=' + n, /*async*/true);
			searchReq.onreadystatechange = handleCommentRetrieve; 
			searchReq.send(/*no params*/null);
		}
	}

	//Called when the AJAX response is returned.
	function handleCommentRetrieve() {
		if (searchReq.readyState == 4) {
			win = new Window({className: "dialog", title: "Comments", width:400, height:350, destroyOnClose: true, recenterAuto:false}); 
			win.getContent().update(searchReq.responseText); 
//			win.getContent().innerHTML= "<h3>Hello, my darling!</h3>";//searchReq.responseText;
			win.showCenter();	

		}
	}
I get the same result as the previous one. And I try your approach without any luck.

When I replace the Ajax response section with a static text, the content is shown.
vw98034 is offline   Reply With Quote
Old 02-03-2009, 06:48 PM   PM User | #8
vw98034
Regular Coder

 
vw98034's Avatar
 
Join Date: Feb 2004
Posts: 194
Thanks: 3
Thanked 0 Times in 0 Posts
vw98034 is an unknown quantity at this point
Quote:
Originally Posted by vw98034 View Post
Thanks "Oh God" for your follow-up.

I have tried more than one ways to get the content up on the popup window. The first try is with Dialog as the following:

Code:
		Dialog.alert({url: '../webSiteEntry/getComments.htm?wid=' + wid, options: {method: 'get'}}, {className: "alphacube", width:540, okLabel: "Close"});
The content doesn't show up with IE 7, but FireFox and Safari. And I try the following:
Code:
	function retrieveComments(n){

		if ((searchReq.readyState == 4 || searchReq.readyState == 0) ) {
			searchReq.open("GET", '../webSiteEntry/getComments.htm?wid=' + n, /*async*/true);
			searchReq.onreadystatechange = handleCommentRetrieve; 
			searchReq.send(/*no params*/null);
		}
	}

	//Called when the AJAX response is returned.
	function handleCommentRetrieve() {
		if (searchReq.readyState == 4) {
			win = new Window({className: "dialog", title: "Comments", width:400, height:350, destroyOnClose: true, recenterAuto:false}); 
			win.getContent().update(searchReq.responseText); 
//			win.getContent().innerHTML= "<h3>Hello, my darling!</h3>";//searchReq.responseText;
			win.showCenter();	

		}
	}
I get the same result as the previous one. And I try your approach without any luck.

When I replace the Ajax response section with a static text, the content is shown.
Ok, it seems to be some problems on the data retrieval with IE 7, but not the library itself.
vw98034 is offline   Reply With Quote
Old 02-03-2009, 06:50 PM   PM User | #9
ohgod
Regular Coder

 
ohgod's Avatar
 
Join Date: Jun 2008
Location: Ohio
Posts: 579
Thanks: 6
Thanked 69 Times in 69 Posts
ohgod is on a distinguished road
Code:
win.getContent().update(searchReq.responseText);
where do you see update() in the api?

Code:
win.getContent().innerHTML
why aren't you using setHTMLContent(html) ?



where is wid set prior to your attempt at an alert?

most likely is that you're battling an incompatibility in ie7. there is usually a workaround, we just have to identify the problem first.
ohgod is offline   Reply With Quote
Old 02-04-2009, 12:22 AM   PM User | #10
vw98034
Regular Coder

 
vw98034's Avatar
 
Join Date: Feb 2004
Posts: 194
Thanks: 3
Thanked 0 Times in 0 Posts
vw98034 is an unknown quantity at this point
Quote:
Originally Posted by ohgod View Post
Code:
win.getContent().update(searchReq.responseText);
where do you see update() in the api?

Code:
win.getContent().innerHTML
why aren't you using setHTMLContent(html) ?



where is wid set prior to your attempt at an alert?

most likely is that you're battling an incompatibility in ie7. there is usually a workaround, we just have to identify the problem first.
Thanks for your information.

I am still battling with this problem. The root problem is that the request is not sent with IE 7, but does with Firefox and Safari. I haven't figured out the cause yet.
vw98034 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:06 AM.


Advertisement
Log in to turn off these ads.