Prev | Current Page 69 | Next

Larry Ullman

"Building a Web Site with Ajax: Visual QuickProject Guide"


78 adding records via Ajax
display the results
The fi nal step in the Ajax process is to display the results message
by placing that message on the HTML page. This code completes
the handleResponse() function. (See extra bits on page 86.)
3 If we didn??™t get a valid status code back
from the Ajax request, we should formally
submit the form to the handling PHP page
(as if the Ajax layer didn??™t exist at all).
??¦
document.getElementById(temp + ???_label??™).className =
???error??™;
}
results.innerHTML = message[0].firstChild.
nodeValue;
results.style.display = ???block??™;
} else {
document.getElementById(???emp_form??™).submit();
}
} // End of readyState IF.
} // End of handleResponse() function.
2 Because the results
area is initially invisible, we
need to make it visible now
that we have some results
to display.
1 The text in the results area is set to the
returned response from the Ajax request.
adding records via Ajax 79
test the Ajax layer
1 Load the HTML page in your
Web browser.
The address must begin with
http:// for this to work.
2 Fill out the form incompletely or
improperly and click Add.


Pages:
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81