php ajax multiple requests -
i been learning php , ajax w3schools have come across question cant find answer to.
to request php file use xmlhttprequest object , specify url (of php file). mean 1 php file 1 request only? let's on webpage there user log-in box , comment box, need 2 php files take requests? thought server side have 1 main file handle requests, each request client have id specify request , send necessary data client. right?
i read lot of material online, basic example 1 request , 1 response.
you can use same file multiple requests. can supply parameters along ajax request, either including them in url after ?
(they'll available in $_get
, $_request
) or using post
method , sending them form data (they'll available in $_post
, $_request
). can use javascript formdata api encode properly; see documentation here. using jquery library can simplify of this.
one of parameters can command or operation code, , script can take different actions based on this.
Comments
Post a Comment