469,329 Members | 1,391 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,329 developers. It's quick & easy.

ajax and new window

Is it possible with AJAX and javascript to display the result in a new window(target="_blank")

i.e
<a href="javascript:getReport()" target="_blank">

The get report method makes XMLHTTPRequest with the server. The response of which should be shown in a new popup. If i try the above procedure i am getting javascript error.
Nov 15 '06 #1
1 1928
ronverdonk
4,258 Expert 4TB
Why should you want to use AJAX to accomplish that?? Usually Ajax is used to prevent opening new windows or re-loading the current one, so this solution looks a bit overkill.

You can accomplish the same with an JS function that opens a new window and calling your server program. Example:

Your HTML looks like this:
Expand|Select|Wrap|Line Numbers
  1. <input type="button" onClick="OpenWindow()" value="Show report">
and your JavaScript function could look like this:
Expand|Select|Wrap|Line Numbers
  1. function OpenWindow() {
  2.     newWindow=window.open('server_program', 'server', window_dimensions);
  3. }
Ronald :cool:
Nov 15 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by germ | last post: by
4 posts views Thread by sheldonlg | last post: by
2 posts views Thread by Gufo Rosso | last post: by
11 posts views Thread by =?Utf-8?B?R2VyaGFyZA==?= | last post: by
1 post views Thread by petvampire | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.