Support » Networking WordPress » Ajax in subsite

  • Resolved herbert

    (@herbie4)


    I have the Ajax content working in a sub-site set up as sub-directory. When I change to domain mapping the Ajax stops working.

    The following code is in my sub-site child theme header.php:

    jQuery.ajax({
         url:"<?php bloginfo('url')?>/wp-admin/admin-ajax.php",
         type:'POST',
         data:'action=my_special_action&main_postid=' + mainPostID,
         dataType: 'html',
         beforeSend: function() {
             jQuery('#test').html('<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/ajax-loading.gif" alt="pagina is aan het laden..." />');
                 if(!mainPostID) {
                     $('#test').html('<p>Oops! There is no data...</p>');
                     return false;
                 }
         },
         success:function(result) {
         // alert(result);
         jQuery("#test").html(result);
         }
    
     });

    It probably has something to do with the call to admin-ajax.php.
    So I tried using the full domain of the main website, that did not work.
    I also used the domain of the sub-website. That did not work.

    Hope someone can point me into the right direction.

Viewing 4 replies - 1 through 4 (of 4 total)
  • When you change to domain mapping, go Edit the site so all the references to the subdomain are gone.

    Thread Starter herbert

    (@herbie4)

    When you change to domain mapping, go Edit the site so all the references to the subdomain are gone.

    Thanks for the response.
    Can you explain what you mean with ‘edit the site’?
    I am not using subdomain but virtual domain and the sub-sites are set up as sub-directory sites in the main blog.
    There is no problem with the sub-site it works perfectly under the virtual domain. There is only the problem that the ajax content doesn’t load anymore…

    Thread Starter herbert

    (@herbie4)

    UPDATE:
    I checked in FireBug for the post to /wp-admin/admin-ajax.php it shows a “302 Moved Temporarily” that is why it is not working I guess. It also refers to jQuery.js line 130.

    Ideas anybody…?

    Thread Starter herbert

    (@herbie4)

    SOLVED:
    In the domain mapping configuration do NOT select: “Redirect administration pages to site’s original domain (remote login disabled if redirect disabled)”.

    Now my ajax content is working on the virtual domain!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Ajax in subsite’ is closed to new replies.