开发者

How does AJAX work in PHP with SAJAX?

开发者 https://www.devze.com 2023-03-28 19:32 出处:网络
I have a PHP application that scrapes web site content and stores data into text file on server. I have all the functions written in functions.php. There is a function which when called does all the

I have a PHP application that scrapes web site content and stores data into text file on server.

I have all the functions written in functions.php. There is a function which when called does all the job and calls many other functions within the same functions.php.

How ever when I try to invoke this function from a remote AJAX call using SAJAX framework it does not work the way it should. But if I call the function as a normal page load function.php and have the main function invoked in the top it works well.

I am completely lost, since AJAX is new thing to me. My confusion is that does AJAX calls initialize the function.php server side script as a whole or does it only initialize the particular function?

I am now going to try something with jQuery, but for that I have to spend few more 开发者_JAVA技巧hours to do my understanding that how ajax with jQuery works.


When you make a request with AJAX, it is identical to calling up the page in your browser. (Except for a header or two, but that doesn't matter here.)

If I were to load up http://www.somedomain.com/somescript.php in my browser, I would get the exact same result as if I loaded it with AJAX.

AJAX/anything client side does not care or know about the fact that you run PHP. They are completely separate. It is up to the server to load PHP, and then PHP/your script to load whatever is necessary to process the request.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号