[SOLVED]Updating php without refresh | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

[SOLVED]Updating php without refresh

Is there any way to refresh a page's PHP like Jquery does ($("#id").load("Your.php")) with PURE JS? I'm trying to make my api/project minimal so it wont have to download it every time any external APIs. (...) <div id=textGoesHere" style="background-color:#AFAFAF;" onload="UpdatePhp(this,'tehFile.php');" ></div> (...) Thanks for any help from now on.

10th Mar 2018, 3:25 PM
Arda Aydın
Arda Aydın - avatar
1 Answer
+ 5
PHP is rendered server-side. From client-side Javascript, your request to refresh something PHP-related would actually be instructing the server to send you the *resulting output* of processing PHP. With this (hopefully not too clumsy) clarification, things like AJAX, websockets, XMLHTTPRequest (XHR) and Fetch are perfectly suitable for asking servers to run little pieces of PHP and deliver anything you like to inject into the current page; including replacing content generated exclusively by PHP.
10th Mar 2018, 11:00 PM
Kirk Schafer
Kirk Schafer - avatar