0

How can I download new content in a HTML script? More specifically, I'm looking for a way to update a page without it being completely reloaded. I have searched Google to no avail. Most probably I don't know the proper search query to enter.

My home project is a chat site with "lazy loading" or "infinite scrolling" content from input of its users.

Two side questions: Is the best application for this project PHP, Java, or something else? How is a Javascript paused without blocking?

motoku
  • 1,571
  • 1
  • 21
  • 49

3 Answers3

1

The proper search query is "ajax".

Normally one would use PHP for your requirements, but I would suggest to use a programming language you are already comfortable with. I.e. if you already know Java then use it.

For a "techy-er" chat app, you may research on "server push"

Manny
  • 6,277
  • 3
  • 31
  • 45
  • "Server Push" seems like the way to go. I'm already familiar with Java. However, Microsoft support may be an issue. According to the site http://www.w3schools.com/ajax/, "If the server is busy or slow, the application will hang or stop." On the other hand, I'm unsure if I want so many Java Sockets open at once. – motoku Jan 05 '11 at 19:43
  • Why would Microsoft support be an issue? We've developed a server push framework based on Comet approach, and it's working fine even in Microsoft IE. You may want to check out the Comet approach or this question http://stackoverflow.com/questions/1728020/best-solution-for-java-http-push-messaging – Manny Jan 06 '11 at 03:11
0

AJAX/XMLHttpRequest is what you are looking for. A small example using JavaScript/jQuery:

$('#some-container').load('http://example.com/');

PHP is probably the way to go here. Asynchronous calls in JavaScript are implemented using callback functions.

jwueller
  • 30,582
  • 4
  • 66
  • 70
0

Making a chat script will require some kind of server side language, I highly recommend PHP. The combination of ajax/PHP should give best results. Json long polling is also good

SUDO Los Angeles
  • 1,555
  • 12
  • 10