Suppose you have something like this
HTML FILE:
<head></head>
<body>
<div id="my_personal_div">
</div>
</body>
Javascript FILE:
$.(document).ready(){
$.ajax({
url:/any_php.php,
...
...
if (msg){
$("#my_personal_div").html(msg);
}
});
My any_php.php File:
echo "<img src=any_image.jpg />"
So the Idea is to have a Dynamic div into a html fill it out with some php content created by me, so I can feed multiple htmls with that div at once. What would be the problem of all this???? any cons??? any Huge security problem?, any better way to have a complete personal feeding, I mean, because I can puy there image, inputs, text, images, etc whatever I want from the php file.
The Cons is that it will make one more http request each time, and that takes time… And resources.
So it’s a good way if you just have to change something on the page without reloading all the page.
A good way of practicing this also is when the user want to change page instead of reloading the all page just loading the content that had changed and using the push state on the browser to indicate that it’s a new page. For example the website http://gizmodo.com/ use this.
No problem on the side of security by the way, it’s just like loading a new page.