开发者

How to escape \" in eval ? It throws error: expected identifier

开发者 https://www.devze.com 2023-03-29 11:35 出处:网络
when iam trying to eval : <span style=\\\"color: #ff0000;\\\"> It throws error when unexpected identifier. How to escape it?

when iam trying to eval :

<span style=\"color: #ff0000;\">

It throws error when unexpected identifier. How to escape it?

I get result from server aaaas follows:, the EXT Js (JS framework) reader not able to read it.

{
    "items": [{
        "id": "671",
        "post_title": "Seche Vite Dry Fast Top Coat",
        "post_content": "<span style=\"color: #ff0000;\"><st开发者_开发百科rong>Roy Recommends:<\/strong>\u00c2\u00a0 Edith, our in-house nail expert, swears by this product.\u00c2\u00a0 No manicure or pedicure is complete without adding this top coat as the finishing touch.<\/span>\r\n\r\nSeche Vite\u00e2\u201e\u00a2 dry fast top coat is widely acknowledged as the world\'s finest top coat.\u00c2\u00a0 Specially formulated to penetrate through nail lacquer to the base coat forming a single solid coating over the nail plate for a much more durable finish. Guaranteed not to yellow while leaving nails silky, stronger and resistant to chipping and peeling.\r\n\r\n&nbsp;",
        "post_excerpt": "",
        "post_status": "publish",
        "post_parent": "0",
        "parent_sort_id": "671",
        "prod_meta_data_key": "_wpsc_product_metadata",
        "category": "Roy Recommends,Nail Care",
        "_wpsc_price": "10",
        "_wpsc_special_price": "0",
        "_wpsc_sku": "",
        "_wpsc_stock": "4",
        "unpublish_when_none_left": "1",
        "weight": 8.5,
        "weight_unit": "ounce",
        "height": "0",
        "height_unit": "in",
        "width": "0       ",
        "width_unit": "in",
        "length": "0",
        "length_unit": "in",
        "local": "0",
        "international": "0",
        "no_shipping": "0"
    }],
    "totalCount": "1"
}


Try to use single quotes instead of double quotes <span color='blue'>...</span>

Or instead of html formatting it directly, just send the data and handle the formatting client-side, you know the identifier of the data so you will be able to single it out and format it.

0

精彩评论

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