Question: I have again a problem with my ajax requests. my architecture hasn't change, so I use a Java servlet on the server side, and on the client I'm running a JavaScript application, programmed and tested with firefox. In firefox I also installed firebug, because it's very comfortable to watch the incoming and outgoing ajax requests. however, my problem is the following: 

Sometimes, I have to make more ajax requests. I always check before I send a new one, if the XMLHttpRequest object is ready to send (so if it is in state 0 or 4) and only then I fire. 
A normal ajax request takes approximately 200 to 300 ms. But sometimes, I see responses in firebug after 10 or 30 ms, which didn't contain any data (but the request arrives the servlet). But when I dump the response, that I want to send to the client im my servlet, I see the correct string. So it seems that the servlet didn't send it to the client. I tried a flush() in the servlet but nothing changed. I have also already implemented the advice from my previous post ([Problem with AJAX responses](https://stackoverflow.com/questions/1298051/problem-with-ajax-responses)), that I shouldn't make the PrintWriter object, you get with res.getWriter() (HttpServletResponse res) global (so now it is local in my doPost method).

Does anybody have an idea what's going wrong?

Answer: 
If you need to call javascript function you can use 

```
Page.RegisterStartupScript

```

See [msdn](http://msdn.microsoft.com/en-us/library/system.web.ui.page.registerstartupscript.aspx)

For the second part you can use 

```
window.open 

```

method

See [here](http://www.w3schools.com/HTMLDOM/met_win_open.asp)
Perhaps you're looking for [Script#](http://projects.nikhilk.net/ScriptSharp/)? 

Script# brings the power and productivity of C# and .NET tools to Ajax development by compiling C# source code into regular JavaScript.