Skip to content Skip to sidebar Skip to footer

How To Prevent The Browser From Requesting The Assets Come From The Ajax Response

It might be a silly question, but please consider I'm very newbie in web. I made an ajax with jquery $.ajax , then I put the response in a
on the current page, and once

Solution 1:

This has nothing to do with PHP or headers returned from the server, but when you include this html-snippet into the DOM, the browser will try to render it.

In your case, if it includes an img-tag and the src-attribute is set, it will try to fetch the contents, to be able to show it to the user.

Remove the img-tag from the html, or send the data as a JSON-object instead, which you can use to populate the correct html with when you would like to render it on the page.


Post a Comment for "How To Prevent The Browser From Requesting The Assets Come From The Ajax Response"