(file) Return to pingtest.js CVS log (file) (dir) Up to [Development] / ajaxlib / test

File: [Development] / ajaxlib / test / pingtest.js (download) / (as text)
Revision: 1.1.1.1 (vendor branch), Sun Apr 3 14:51:04 2005 UTC (5 years, 5 months ago) by ignatzmo
Branch: ajaxlib, MAIN
CVS Tags: ver_1-0, HEAD
Changes since 1.1: +0 -0 lines
initial import

HttpRequest.prototype.ping = function()
{
	var ret = "PING TEST<br />"
	
	this.setTarget(this._pingTarget)
	var pingGet = this.get()
	if (pingGet == "ping") 
	{
		ret += "&nbsp;&nbsp;&nbsp;&nbsp;HttpRequest.synchronousGet() returns ping: successful.<br />"
	}
	
	var url = new URLBuilder()
	url.addVar("word", "ping")
	this.setForm(url)
	var pingPost = this.post()
	
	if (pingPost == "pong")
	{
		ret += "&nbsp;&nbsp;&nbsp;&nbsp;HttpRequest.synchronousPost() returns pong: successful."
	}
	else
	{
		ret += "&nbsp;&nbsp;&nbsp;&nbsp;HttpRequest.synchronousPost() ping Failed... returned " + pingPost
	}	
	this.setTarget(document.URL)
	return ret
}

var http = new HttpRequest()
http.setTarget("http://www.example.com/foo")
// Pass in the form that we want to post. 
http.setForm(new URLBuilder().addVar("foo", "bar"))
// For asyncronous, pass in a closure.
http.post()

root@ad1455.com
Powered by
ViewCVS 0.9.2