document.write(' '); document.write(' '); function sack(file){this.xmlhttp ...
function sack(file){this.xmlhttp=null;this.resetData=function(){this.method="POST";this.queryStringSeparator="?";this.argumentSeparator="&";this.URLString="" ...
]]>I am putting my add_action into my themes functions.php file and it looks like so.
add_action('wp_head','myplugin_js_header');
add_action('wp_ajax_nopriv_someaction','tehcallback');
function myplugin_js_header(){
wp_print_scripts(array( 'sack' ));
}
also inside my functions.php file is my callback which looks like this
function tehcallback(){
echo "alert('1')";
die();
}
Not trying to do anything just trying to get a return at this point.
I have a java file which I add to the header which has my code that executes on click of a specific link.
function javafunc(url,postid,obj){
var mysack = new sack('https://localhost/tehsite/wp-admin/admin-ajax.php');
mysack.execute = 1;
mysack.method = 'POST';
mysack.setVar("action", "nopriv_someaction");
mysack.setVar("url", url.value);
mysack.setVar("postid", postid.value);
mysack.setVar("obj", obj.value);
//mysack.onError = function() {alert('Ajax error')};
mysack.runAJAX();
return true;
}
I have tested and by clicking the link it does reach the java part. But then nothing happens I never get any sort of response from the server. No error or anything. Does anyone know what is wrong here?
]]>i have this :
die( "document.getElementById('$results_id').innerHTML = '$results'");
If i want to update 2 divs (say results_id , and results_id2 , how would i do this with one die statement?
Is there any other method other then die to accomplish this using sack?
thanks
]]>'sack' is undefined
. I worked out with some simple searching in my code that WP-polls was the problem, because it uses the script wp-includes/js/tw-sack.js
which contains the function sack
.