Created
August 5, 2014 05:57
-
-
Save stankobrin/61843fefef464e8778a3 to your computer and use it in GitHub Desktop.
ajax call
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JavaScript Document | |
function apfaddpost(posttitle,postqty,postlink,postcode,postdesc,postprice) { | |
jQuery.ajax({ | |
type: 'POST', | |
url: apfajax.ajaxurl, | |
data: { | |
action: 'apf_addpost', | |
apftitle: posttitle, | |
apfqty: postqty, | |
apflink: postlink, | |
apfcode: postcode, | |
apfdesc: postdesc, | |
apfprice: postprice, | |
}, | |
success: function(data, textStatus, XMLHttpRequest) { | |
var id = '#apf-response'; | |
jQuery(id).html(''); | |
jQuery(id).append(data); | |
resetvalues(); | |
}, | |
error: function(MLHttpRequest, textStatus, errorThrown) { | |
alert(errorThrown); | |
} | |
}); | |
} | |
function resetvalues() { | |
var title = document.getElementById("apftitle"); | |
title.value = ''; | |
var content = document.getElementById("apfqty"); | |
content.value = ''; | |
var content2 = document.getElementById("apflink"); | |
content2.value = ''; | |
var content3 = document.getElementById("apfcode"); | |
content3.value = ''; | |
var content4 = document.getElementById("apfdesc"); | |
content4.value = ''; | |
var content5 = document.getElementById("apfprice"); | |
content5.value = ''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment