How to properly escape html sent as data in jQuery's .ajax function

前端 未结 1 450
予麋鹿
予麋鹿 2020-12-11 16:25

UPDATE: Once I looked at the problem in Firebug, I found my mistake immediately. And it was an embarrassing unmatched double quote that I must have deleted

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-11 17:10

    You don't need to escape or encode. jQuery will take care of properly URL encoding the data:

    data: { someHtml: $(this).html().substring(0, 1000) },
    

    0 讨论(0)
提交回复
热议问题