Viewer Side AJAX using SACK not Working… HELP!
-
Ok I am trying to setup some viewer side ajax for non logged in users (no registration on my site). I am trying to use SACK and I am having a bunch of trouble.
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?
- The topic ‘Viewer Side AJAX using SACK not Working… HELP!’ is closed to new replies.