- Uncaught SyntaxError: Unexpected token ILLEGAL when returning a £ symbol using JSON
- var currency = "";
- var price = "";
- $.ajax({
- type: 'GET',
- url: '../JSONDeliveryPrice/',
- dataType: 'json',
- success: function (data) {
- price = eval(data.price);
- currency = eval(data.currency);
- },
- async: false
- });
- console.log(price);
- console.log(currency);
- public virtual ActionResult JSONDeliveryPrice()
- {
- string currency = "£";
- decimal price = 123;
- return Json(new { price = price, currency = currency }, JsonRequestBehavior.AllowGet);
- }
- ...
- success: function (data) {
- price = data.price;
- currency = data.currency;
- },
- ...