I have an Ajax script that is currently receiving a JSON data string and appending the data to a <li>
on the page, like this:
This is the Jquery script I am using to do this:
jQuery(document).ready(function($) {
$('form.quform').Quform({
successStart: function (response) {
var li = $("<li>").text(JSON.stringify(response));
$("#response").append(li)
But I want to assign variables to the 5 field results and display them in spans so they look something like after I add css to them:
I have tried different things to get this to work, and read a lot of stack articles, One Stack article says to assign the string a variable like this var data = JSON.stringify(myObject, replacer);
, but it has not worked. This is the last thing I have tried, but I know it is not right. Any help would be appreciated, thanks.
jQuery(document).ready(function($) {
$('form.quform').Quform({
successStart: function (response) {
var data = JSON.stringify(myObject, replacer);
var content = "balance: " + data.balance + " account_number:" + data.account_number;
var li = $("<li><span>").text(content);
$("#response").parent().append(li);
Also this is the JSON string I receive to the page:
{"type":"success","message":"Your message has been sent, thank you.","record":{"id":108,"bank_name":"Jane Doe","balance":"200","account_number":"8765432187654321","customer_id":"250","monthly":"50"}}