i am using the same theme for 2 language site - i didnt use a plugin but rather created a multisite (i like it better) - but...

i have a problem with ajax which seems to work for main site but not for sub-domain site.

I tried to find a solution and as far as i can gather
it has something to do with the admin-ajax not working for sub domains.

There is nothing wrong with the function itself but rather the way stuff works in multi site and in particular in subdomains

Nevertheless - here is the function:

$.post(ajax_object.ajaxurl, {
    action: 'action_submit_faq',
    sendername: sendername,
    senderemail: senderemail,       
    subject: subject,       
    questiontitle: questiontitle,       
    questionbody: questionbody,
    questionbodytwo: questionbodytwo,
    nonce: nonce,       
    dvashpot: dvashpot,     
}, function(data) {
    var $response       = $(data);
    var success         = $response.filter('#success').html();
    var error           = $response.filter('#error').html();


    if(success) {
        $.bootstrapGrowl(success, {type: 'success',offset: {from: 'bottom', amount: 20},align: 'right',width: 'auto',delay: 4000,allow_dismiss: true,stackup_spacing: 10});

    if(error) {$.bootstrapGrowl(error, {type: 'danger',offset: {from: 'bottom', amount: 20},align: 'right',width: 'auto',delay: 4000,allow_dismiss: true,stackup_spacing: 10});}


is there a workaround?
something i do to make ajax work in sub-domain?

  • 1
    Where is your wp_ajax_action_submit_faq defined? Is the ajax_object.ajaxurl generating the correct url? – czerspalace Aug 24 '15 at 6:26
  • the wp_ajax_action_submit_faq - is defined in the PHP file - ... it does work for main top / no sub-domain site. so... its the right url - but doesnt seem to be the right one when using multisite in a sub domain – Sagive SEO Aug 24 '15 at 23:31
  • Defined in which PHP file? And how are you creating the ajax_object.ajaxurl? – czerspalace Aug 24 '15 at 23:42
  • "ajax_object.ajaxurl" is a built in wordpress url - I would bounty this question tommarow - thanks for trying to help but you keep searching for what is broken - but this works for main site - just not for sub domain site - conclusion... this works, defines well, finds the PHP. I need a conditional (i think) / relative to sub domain "ajaxurl" or other solution. – Sagive SEO Aug 25 '15 at 0:21
  • I ask these questions because if it is in a plugin, are you sure the plugin is activated for 2nd site. If it is in functions.php, are you using the same theme for both sites? – czerspalace Aug 25 '15 at 3:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.