Pregunta

I have the following simple example where I have 3 types of settings that I am passing via ajax.

var settings = {
    "one" : "V&T",
    "two" : "V & T",
    "three" : "V&T100",
    "four" : "V&T1"
};

return $.ajax({
    url  : myUrl,
    type : "POST",
    data : {"settings" : settings},
});

When I check my post data in php these are rendered as follows

Array(
[settings] => Array
    (
        [one] => V&T
        [two] => V & T
        [three] => V&T100;
        [four] => V&T1;
    )
)

Note how for three and four I now havethe semi-colon(;) added to these variables.

Is there any kind of work around for this or has anyone a solution? This is a very simplified example, my full code actually uses knockout to render the settings.

¿Fue útil?

Solución

Codeigniter global xss filtering was encoding the ampersand and adding the trailing semicolon(;).

As I was unable to disable the global xss filtering I opted to use the raw php://input to get my data.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top