Viewer Side AJAX using SACK not Working... HELP! (4 posts)

  1. fatalx
    Posted 5 years ago #

    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.

    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')";

    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('http://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')};
    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?

  2. fatalx
    Posted 5 years ago #


  3. fatalx
    Posted 5 years ago #

    cool thnx

  4. juancgi
    Posted 5 years ago #

    any luck?? i am having the same problem.

Topic Closed

This topic has been closed to new replies.

About this Topic