surveywp / kk-star-ratings

kk Star Ratings wordpress plugin
https://wordpress.org/plugins/kk-star-ratings
Other
118 stars 44 forks source link

fix: ajax json error #125

Closed gbretas closed 1 year ago

gbretas commented 1 year ago

I have fixed an error that is listed in wordpress.org

https://wordpress.org/support/topic/add-rating-not-working/

https://wordpress.org/support/topic/i-cant-vote/

kamalkhan commented 1 year ago

I don't think the quotes is an issue. The double quotes in the attribute is already encoded.

gbretas commented 1 year ago

@kamalkhan this is the only thing that is causing the issue.

the payload have double quotes that is not encoded, and change to single quotes solved the problem. I have test, and you can check at diariomomento.com.br

you can check the people with same problem.

https://github.com/kamalkhan/kk-star-ratings/issues/124#issue-1434162546

kamalkhan commented 1 year ago

This is the output html. Please let me know if you find double quotes in the attribute value which needs to be escaped.

data-payload="{"align":"left","id":"1","slug":"default","valign":"top","ignore":"","reference":"auto","class":"","count":"3","readonly":"","score":"4.7","best":"5","gap":"5","greet":"Rate this post","legend":"4.7\/5 - (3 votes)","size":"24","width":"133.8","_legend":"{score}\/{best} - ({count} {votes})","font_factor":"1.25"}"
gbretas commented 1 year ago

I”ve test in WordPress 6.0.3 and it’s not escaping. There is many people in Wordpress.org with this problem.