Sk Asraf Sk Asraf - 4 months ago 6x
Ajax Question

span tag text not change using JQuery ajax

i cant give json value to span tag
actually i am using jquery ajax function

var productId = $("#product_id").text();
var city = $("#spn-deliveryloccookies").text();

url: '/Product/est_time',
type: 'GET',
data: { 'city': city, productid: productId },
contentType: 'application/json; charset=utf-8',
success: function (res) {
//your success code

error: function () {
alert("some error");

after that it produce result
firebug result
and the web page having a

i cant give the text value in to span tag

in my ajax function success block there have **alert(res); and it work fine it produce result**

image link

$("#p_price").text(res.ourPrice); not work


You need to parse the json string to javascript object. Then only you access its properties.