Prev | Current Page 71 | Next

Larry Ullman

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


set up the Ajax p. 64
??? The POST method should generally
be used when the form??™s
submission should have an e?¬? ect
on the site. For example, using
the add-an-employee form adds
another record to the database.
??? The GET method should generally
be used when requesting
information??”for example, when
requesting the employees in a
specifi c department.
82 adding records via Ajax
prepare the form data p. 65
??? When a form is submitted using
the GET method, you??™ll see the
form data in the URL, with
a syntax of page.php?this_
item=this_value&that_
item=that_value. This is the
same syntax used by POST, but
the data isn??™t sent in the URL
and you don??™t need the question
mark.
??? All of the form data needs to be
run through the encodeURIComponent()
function to make it safe
to send to the PHP page. Rather
than apply that function to each
value separately, using a for loop
on an array of form elements lets
us accomplish the same thing
with less code.
??? The plus sign in JavaScript
is used to perform concatenation:
appending one string onto
another. In PHP, the period does
the same thing.


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