Server-Side Data

CSE 190 M (Web Programming), Spring 2008

University of Washington

Except where otherwise noted, the contents of this presentation are © Copyright 2008 Marty Stepp and Jessica Miller and are licensed under the Creative Commons Attribution 2.5 License.

Valid XHTML 1.1 Valid CSS!

Web data

URLs and web servers

http://server/path/file

Server-Side web programming

php jsp ruby on rails asp.net

Parameterized programs

Passing parameters (query strings)

http://www.google.com/search?q=colbert&ie=utf-8

Web data example

Submitting data to a web server

get requests and submitting data

An HTTP get request is not an appropriate way to submit data to a web server.

HTTP get vs. post requests

Recall from our first lecture, HTTP allows several kinds of web requests:

For submitting data, a post request is more appropriate than a get.

Creating a post request

new Ajax.Request(
	"url",
	{
		method: "post",   // optional
		parameters: { name: value, name: value, ..., name: value },
		onSuccess: functionName,
		onFailure: functionName
	}
);

Practice problem: Submitting ASCII art

Debugging Ajax Code

Finding and fixing problems when interacting with server-side data

Ajax code bugs

When writing Ajax programs, there are new kinds of bugs that are likely to appear.

How do we find and fix such bugs?

Debugging in Firebug

Firebug JS Debugger

Breakpoints

Firebug breakpoint

Stepping through code

Firebug breakpoint

Debugging Ajax code

Firebug Ajax

Debugging responseXML

Firebug Debug Ajax