开发者

AJAX not properly handling input

I'm creating a WYSIWYG editor that saves the page via AJAX.

How it works is you add your elements (text, images, etc) to a DIV via the editor, and when you click "save", it sends that DIV's HTML through AJAX to a script that takes this HTML and writes it into "index.html", so it'll update the front page.

My problem: if the DIV has a background image, the AJAX page screws up. Something to do with all the quotes is my guess (<div style="background-url('picture.png');">). It handles everything else fine (images, text with both single and double quotes, etc).

I was looking through Firebug, and it's reporting that it's changing t开发者_JAVA技巧he 'picture.png' to &quot;picture.png&quot;. I've tried replacing the &quot; before it sends, but it's still breaking on the other end from all the quotes.

Does anyone have any idea?


What language is handling your AJAX on the other end? If it's PHP, check out htmlentities(). Also, the ampersand (&) has broken my ajax requests in the past.


try dumping it server side - i'd expect its something to do with URL encoded (i.e. % encoded) quotes and/or your server side software adding backslashes

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜