php - Ajax returning strange extra html -
I have several snippets of HTML content that loads on the page based on the current selected area of the world. Here's the request:
jQuery ('# vmap'). VectorMap ({map: 'world_en', background color: '#fff', // more map config options .. OnRegionClick: function (element, code, area) {// post request $ .ajax ('/ get_post_data. Php ', {data: {area: area}, data type:' html ', success: work (feedback) {$ ("#post"). Html (feedback);}});}}); Here is get_post_data.php:
$ result = ';; // Swatches based on area switch ($ _ request ['region']) {// Asia case 'China': case 'Japan': $ result = @ included (include '/ asia.in.php'); break; // Africa case 'Ethiopia': case 'Kenya': $ result = @ included ('included / africa.inc.php'); break; $ Return result; and inc.php files look like this:
& lt; H2 & gt; Asia & lt; / H2 & gt; & Lt; P & gt; Articles for the Asia region & lt; / P & gt; When AJAX runs, this same HTML is posted on the page, but in the extra H2 tags, the paragraph is wrapped, which I have not written anywhere, and this is "1 "As a post-mark after a string response after the P tag:
I do not know why these two extra things have been added to the markup I want to see when I see the response in the console, then I see the correct HTML, even then "1 "With, but without the H2 tag
That is why you have h2 tag inc.php < in is not closed properly
Comments
Post a Comment