I realize this is close to other questions. I simply can;t find the answer.
I have an onclick event that successfully fires an AJAX POST to PHP.
The Data are returned successfully in an encoded_json array.
function upvote(str,str2) {
---do a bunch of stuff
}
jQuery.ajax({
type: 'POST',
url: MyAjax.ajaxurl,
data: {"action": "post_my func", "voted_item":theItemid,"vote_value":currentvote, "vote_type":"upvote"},
success: function(data){
var result = JSON.parse(data);
console.log(data)
//console.log(result[2])
//alert(result[2]);
jQuery('#newtexthere').html(data);
}
});
}
I can echo it. I know it's there. The console.log(data) and console.log(result) look like this:
{"rowcount":"18","result":"6"}
All I want to do is echo a part of this array in #newtexthere as in
<p id="newtexthere">
*18*
</p>
Any and all help would be most appreciated!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…