I want to send json-formatted data to jQuery.css () function, and I don't know how to do it. I will post more properties later, this is just an example of my problem.
//Sorry, this var x is actually string that i get when i print my json string var x = {"transform":"rotate(30deg)","-o-transform":"rotate(30deg)"} //If i try to do something like this wont work $("#mainImage").css(x); //but following works $("#mainImage").css({"transform":"rotate(30deg)","-o-transform":"rotate(30deg)"})
Maybe something that jquery accepts .css( map )
A map of the pairs of property values ββto set.
And I'm trying to send a single text string, can I somehow convert json to display?
@Pekka Yes, I'm sure $("#mainImage").css(x); does not work.
@Felix This is what I get by calling json = JSON.stringify(data); sorry if this is not json data i'm new to js ..
source share