Score:0

Ajax call brings all the Javascripts of drupal ruining the original page javascript

it flag
MMT

Based on this solution https://www.drupal.org/docs/7/api/javascript-api/simple-drupal-ajax-load-with-jquery-and-delivery-callback I'm brining with an ajax call, a multistep form. The ajax brought multistep needs ajax as well to execute the steps in between of the multistep form.

The above link advises to use this model of call back function

function myModule_ajax_callback($page_callback_result) {
  $content = drupal_render($page_callback_result);

  $html = '<html><head><title></title>' . drupal_get_css() . drupal_get_js() . '</head><body class="jquery-ajax-load">' . $content . '</body></html>';
  print $html;

  drupal_page_footer();
}

The calls to drupal_get_css() and drupal_get_js get all the javascripts and the css even the ones that are not needed for this multistep form and clash with the same javascript loaded in the initial html.

drupal_get_css and drupal_get_js can take parameters, and I tried it, however my multistep form then does not work anymore, here is my example:

function trtables_ajax_callback($page_callback_result) {
$default_ajax_callback ='<script type="text/javascript">
<!--//--><![CDATA[//><!--
jQuery.extend(Drupal.settings, {"basePath":"\/","pathPrefix":"","setHasJsCookie":0,"bluemasters":{"topoptiontext":"Page selection"},"ajaxPageState":{"theme":"bluemasters","theme_token":"0FYSbK47UeIHGM2zeAEfpp9aeQgimraf8lfAh0eUZko","jquery_version":"default","js":{"0":1,"sites\/all\/modules\/wysiwyg\/wysiwyg.js":1,"1":1,"misc\/jquery.js":1,"misc\/jquery-extend-3.4.0.js":1,"misc\/jquery-html-prefilter-3.5.0-backport.js":1,"misc\/jquery.once.js":1,"misc\/drupal.js":1,"sites\/all\/modules\/eu_cookie_compliance\/js\/jquery.cookie-1.4.1.min.js":1,"modules\/contextual\/contextual.js":1,"misc\/jquery.form.js":1,"sites\/all\/modules\/wysiwyg\/wysiwyg.init.js":1,"misc\/form.js":1,"misc\/ajax.js":1,"sites\/all\/modules\/jquery_update\/js\/jquery_update.js":1,"sites\/all\/modules\/comment_notify\/comment_notify.js":1,"sites\/all\/themes\/bluemasters\/js\/soundmanager2-nodebug-jsmin.js":1,"sites\/all\/themes\/bluemasters\/js\/mp3-player-button.js":1,"sites\/all\/themes\/bluemasters\/js\/inlineplayer.js":1,"2":1,"3":1,"4":1,"sites\/all\/modules\/trtable_quiz\/trtable_quiz.js":1,"misc\/collapse.js":1,"misc\/progress.js":1,"public:\/\/js\/wysiwyg\/wysiwyg_ckeditor_uWMoMQ7qlhtyf-cFJlMTazsAxhCeS88weKBiAtXujAQ.js":1,"sites\/all\/libraries\/ckeditor\/ckeditor.js":1,"sites\/all\/modules\/wysiwyg\/editors\/js\/ckeditor-3.0.js":1,"sites\/all\/modules\/wysiwyg\/editors\/js\/none.js":1,"misc\/textarea.js":1,"modules\/filter\/filter.js":1,"5":1,"modules\/toolbar\/toolbar.js":1},"css":{"modules\/system\/system.base.css":1,"modules\/system\/system.menus.css":1,"modules\/system\/system.messages.css":1,"modules\/system\/system.theme.css":1,"modules\/contextual\/contextual.css":1,"sites\/all\/modules\/comment_notify\/comment_notify.css":1,"modules\/book\/book.css":1,"modules\/comment\/comment.css":1,"modules\/field\/theme\/field.css":1,"modules\/node\/node.css":1,"sites\/all\/modules\/quiz\/quiz.css":1,"modules\/search\/search.css":1,"modules\/user\/user.css":1,"sites\/all\/themes\/bluemasters\/css\/IPA.css":1,"sites\/all\/themes\/bluemasters\/css\/inlineplayer.css":1,"sites\/all\/modules\/ctools\/css\/ctools.css":1,"modules\/locale\/locale.css":1,"https:\/\/maxcdn.bootstrapcdn.com\/font-awesome\/4.7.0\/css\/font-awesome.min.css":1,"sites\/all\/modules\/eu_cookie_compliance\/css\/eu_cookie_compliance.css":1,"sites\/all\/modules\/adsense\/css\/adsense.css":1,"modules\/filter\/filter.css":1,"modules\/shortcut\/shortcut.css":1,"modules\/toolbar\/toolbar.css":1,"modules\/toolbar\/toolbar-print.css":1,"public:\/\/ctools\/css\/85760125e0b573c174141d9adf192778.css":1,"sites\/all\/themes\/bluemasters\/css\/960.css":1,"sites\/all\/themes\/bluemasters\/css\/720.css":1,"sites\/all\/themes\/bluemasters\/css\/481759.css":1,"sites\/all\/themes\/bluemasters\/css\/mobile.css":1,"sites\/all\/themes\/bluemasters\/css\/style.css":1,"sites\/all\/themes\/bluemasters\/css\/basic-layout.css":1}},"eu_cookie_compliance":{"cookie_policy_version":"1.0.0","popup_enabled":1,"popup_agreed_enabled":0,"popup_hide_agreed":0,"popup_clicking_confirmation":false,"popup_scrolling_confirmation":false,"popup_html_info":"\u003Cdiv class=\u0022eu-cookie-compliance-banner eu-cookie-compliance-banner-info eu-cookie-compliance-banner--categories\u0022\u003E\n  \u003Cdiv class=\u0022popup-content info\u0022\u003E\n        \u003Cdiv id=\u0022popup-text\u0022\u003E\n      \u003Cp\u003EWe use cookies on this site to enhance your user experience\u003C\/p\u003E\n              \u003Cbutton type=\u0022button\u0022 class=\u0022find-more-button eu-cookie-compliance-more-button\u0022\u003EGive me more info\u003C\/button\u003E\n          \u003C\/div\u003E\n          \u003Cdiv id=\u0022eu-cookie-compliance-categories\u0022 class=\u0022eu-cookie-compliance-categories\u0022\u003E\n                  \u003Cdiv class=\u0022eu-cookie-compliance-category\u0022\u003E\n            \u003Cdiv\u003E\n              \u003Cinput type=\u0022checkbox\u0022 name=\u0022cookie-categories\u0022 id=\u0022cookie-category-necessary\u0022\n                     value=\u0022necessary\u0022\n                     checked                     disabled \u003E\n              \u003Clabel for=\u0022cookie-category-necessary\u0022\u003ENecessary (normal website functioning)\u003C\/label\u003E\n            \u003C\/div\u003E\n                      \u003Cdiv class=\u0022eu-cookie-compliance-category-description\u0022\u003E\u003C\/div\u003E\n                  \u003C\/div\u003E\n                  \u003Cdiv class=\u0022eu-cookie-compliance-category\u0022\u003E\n            \u003Cdiv\u003E\n              \u003Cinput type=\u0022checkbox\u0022 name=\u0022cookie-categories\u0022 id=\u0022cookie-category-advertising\u0022\n                     value=\u0022advertising\u0022\n                                           \u003E\n              \u003Clabel for=\u0022cookie-category-advertising\u0022\u003EPersonalized advertisements\u003C\/label\u003E\n            \u003C\/div\u003E\n                      \u003Cdiv class=\u0022eu-cookie-compliance-category-description\u0022\u003E\u003C\/div\u003E\n                  \u003C\/div\u003E\n                          \u003Cdiv class=\u0022eu-cookie-compliance-categories-buttons\u0022\u003E\n            \u003Cbutton type=\u0022button\u0022\n                    class=\u0022eu-cookie-compliance-save-preferences-button\u0022\u003ESave preferences\u003C\/button\u003E\n          \u003C\/div\u003E\n              \u003C\/div\u003E\n    \n    \u003Cdiv id=\u0022popup-buttons\u0022 class=\u0022eu-cookie-compliance-has-categories\u0022\u003E\n            \u003Cbutton type=\u0022button\u0022 class=\u0022agree-button eu-cookie-compliance-default-button\u0022\u003EAccept all cookies\u003C\/button\u003E\n          \u003C\/div\u003E\n  \u003C\/div\u003E\n\u003C\/div\u003E","use_mobile_message":false,"mobile_popup_html_info":"\u003Cdiv class=\u0022eu-cookie-compliance-banner eu-cookie-compliance-banner-info eu-cookie-compliance-banner--categories\u0022\u003E\n  \u003Cdiv class=\u0022popup-content info\u0022\u003E\n        \u003Cdiv id=\u0022popup-text\u0022\u003E\n                    \u003Cbutton type=\u0022button\u0022 class=\u0022find-more-button eu-cookie-compliance-more-button\u0022\u003EGive me more info\u003C\/button\u003E\n          \u003C\/div\u003E\n          \u003Cdiv id=\u0022eu-cookie-compliance-categories\u0022 class=\u0022eu-cookie-compliance-categories\u0022\u003E\n                  \u003Cdiv class=\u0022eu-cookie-compliance-category\u0022\u003E\n            \u003Cdiv\u003E\n              \u003Cinput type=\u0022checkbox\u0022 name=\u0022cookie-categories\u0022 id=\u0022cookie-category-necessary\u0022\n                     value=\u0022necessary\u0022\n                     checked                     disabled \u003E\n              \u003Clabel for=\u0022cookie-category-necessary\u0022\u003ENecessary (normal website functioning)\u003C\/label\u003E\n            \u003C\/div\u003E\n                      \u003Cdiv class=\u0022eu-cookie-compliance-category-description\u0022\u003E\u003C\/div\u003E\n                  \u003C\/div\u003E\n                  \u003Cdiv class=\u0022eu-cookie-compliance-category\u0022\u003E\n            \u003Cdiv\u003E\n              \u003Cinput type=\u0022checkbox\u0022 name=\u0022cookie-categories\u0022 id=\u0022cookie-category-advertising\u0022\n                     value=\u0022advertising\u0022\n                                           \u003E\n              \u003Clabel for=\u0022cookie-category-advertising\u0022\u003EPersonalized advertisements\u003C\/label\u003E\n            \u003C\/div\u003E\n                      \u003Cdiv class=\u0022eu-cookie-compliance-category-description\u0022\u003E\u003C\/div\u003E\n                  \u003C\/div\u003E\n                          \u003Cdiv class=\u0022eu-cookie-compliance-categories-buttons\u0022\u003E\n            \u003Cbutton type=\u0022button\u0022\n                    class=\u0022eu-cookie-compliance-save-preferences-button\u0022\u003ESave preferences\u003C\/button\u003E\n          \u003C\/div\u003E\n              \u003C\/div\u003E\n    \n    \u003Cdiv id=\u0022popup-buttons\u0022 class=\u0022eu-cookie-compliance-has-categories\u0022\u003E\n            \u003Cbutton type=\u0022button\u0022 class=\u0022agree-button eu-cookie-compliance-default-button\u0022\u003EAccept all cookies\u003C\/button\u003E\n          \u003C\/div\u003E\n  \u003C\/div\u003E\n\u003C\/div\u003E\n","mobile_breakpoint":"768","popup_html_agreed":"\u003Cdiv\u003E\n  \u003Cdiv class=\u0022popup-content agreed\u0022\u003E\n    \u003Cdiv id=\u0022popup-text\u0022\u003E\n      \u003Cp\u003EThank you for accepting cookiesYou can now hide this message or find out more about cookies.\u003C\/p\u003E\n    \u003C\/div\u003E\n    \u003Cdiv id=\u0022popup-buttons\u0022\u003E\n      \u003Cbutton type=\u0022button\u0022 class=\u0022hide-popup-button eu-cookie-compliance-hide-button\u0022\u003EHide\u003C\/button\u003E\n              \u003Cbutton type=\u0022button\u0022 class=\u0022find-more-button eu-cookie-compliance-more-button-thank-you\u0022 \u003EMore info\u003C\/button\u003E\n          \u003C\/div\u003E\n  \u003C\/div\u003E\n\u003C\/div\u003E","popup_use_bare_css":false,"popup_height":"auto","popup_width":"100%","popup_delay":1000,"popup_link":"\/privacy","popup_link_new_window":1,"popup_position":null,"fixed_top_position":false,"popup_language":"en","store_consent":true,"better_support_for_screen_readers":0,"reload_page":0,"domain":"","domain_all_sites":0,"popup_eu_only_js":1,"cookie_lifetime":"100","cookie_session":false,"disagree_do_not_show_popup":0,"method":"categories","allowed_cookies":"","withdraw_markup":"\u003Cbutton type=\u0022button\u0022 class=\u0022eu-cookie-withdraw-tab\u0022\u003E\u003C\/button\u003E\n\u003Cdiv class=\u0022eu-cookie-withdraw-banner\u0022\u003E\n  \u003Cdiv class=\u0022popup-content info\u0022\u003E\n    \u003Cdiv id=\u0022popup-text\u0022\u003E\n          \u003C\/div\u003E\n    \u003Cdiv id=\u0022popup-buttons\u0022\u003E\n      \u003Cbutton type=\u0022button\u0022 class=\u0022eu-cookie-withdraw-button\u0022\u003E\u003C\/button\u003E\n    \u003C\/div\u003E\n  \u003C\/div\u003E\n\u003C\/div\u003E\n","withdraw_enabled":false,"withdraw_button_on_info_popup":0,"cookie_categories":["necessary","advertising"],"cookie_categories_details":{"necessary":{"weight":0,"machine_name":"necessary","label":"Necessary (normal website functioning)","description":"","checkbox_default_state":"required"},"advertising":{"weight":0,"machine_name":"advertising","label":"Personalized advertisements","description":"","checkbox_default_state":"unchecked"}},"enable_save_preferences_button":1,"cookie_name":"","cookie_value_disagreed":"0","cookie_value_agreed_show_thank_you":"1","cookie_value_agreed":"2","containing_element":"body","automatic_cookies_removal":1,"close_button_action":"close_banner"},"ajax":{"edit-check":{"wrapper":"trtable_quiz_multistep_form","callback":"trtable_quiz_multistep_form_ajax_callback","effect":"fade","event":"click","url":"\/system\/ajax","submit":{"_triggering_element_name":"op","_triggering_element_value":"Check"}}},"urlIsAjaxTrusted":{"\/system\/ajax":true,"\/basic-romanian-yes-no-and-exercises?lesson=10\u0026type=\u0026n=4607":true,"\/comment\/reply\/1148":true},"wysiwyg":{"ckeditor":{"timestamp":"rmu8v6"},"configs":{"ckeditor":{"formatfiltered_html":{"baseHref":"https:\/\/www.learnro.com\/","width":"auto","resize_minWidth":450,"theme":"default","skin":"moono","entities_latin":false,"entities_greek":false,"format_tags":"p;address;pre;h2;h3;h4;h5;h6;div","allowedContent":true,"contentsCss":["https:\/\/www.learnro.com\/themes\/seven\/reset.css?rmu8v6","https:\/\/www.learnro.com\/themes\/seven\/style.css?rmu8v6","https:\/\/www.learnro.com\/themes\/seven\/ie.css?rmu8v6","https:\/\/www.learnro.com\/themes\/seven\/ie7.css?rmu8v6","https:\/\/www.learnro.com\/themes\/seven\/ie6.css?rmu8v6"],"forcePasteAsPlainText":0,"language":"en","simple_source_formatting":0,"toolbarLocation":"top","resize_enabled":true,"toolbar":[["Bold","Italic"]]}}},"plugins":[],"disable":"Disable rich-text","enable":"Enable rich-text","ajaxToken":"a-onf-JoKHQHo-dylWngjFqrTl6MGIgW2ooB7J5jfnc","xss_url":"\/wysiwyg\/xss","triggers":{"edit-comment-body-und-0-value":{"field":"edit-comment-body-und-0-value","resizable":1,"activeFormat":"filtered_html","formatfiltered_html":{"editor":"ckeditor","status":1,"toggle":1}}}},"tableHeaderOffset":"Drupal.toolbar.height"});
//--><!]]>
</script>';

$page_callback_result = '<html><head><title></title>'  .    $default_ajax_callback . '</head><body class="jquery-ajax-load">' . $page_callback_result . '</body></html>';
  print render ($page_callback_result);

  drupal_page_footer();
}

This ajax call to bring the multistep form brings the following html:

<html><head><title></title><script type="text/javascript">
<!--//--><![CDATA[//><!--
jQuery.extend(Drupal.settings, {"basePath":"\/","pathPrefix":"","setHasJsCookie":0,"bluemasters":{"topoptiontext":"Page selection"},"ajaxPageState":{"theme":"bluemasters","theme_token":"0FYSbK47UeIHGM2zeAEfpp9aeQgimraf8lfAh0eUZko","jquery_version":"default","js":{"0":1,"sites\/all\/modules\/eu_cookie_compliance\/js\/eu_cookie_compliance.js":1,"sites\/all\/modules\/wysiwyg\/wysiwyg.js":1,"1":1,"misc\/jquery.js":1,"misc\/jquery-extend-3.4.0.js":1,"misc\/jquery-html-prefilter-3.5.0-backport.js":1,"misc\/jquery.once.js":1,"misc\/drupal.js":1,"sites\/all\/modules\/eu_cookie_compliance\/js\/jquery.cookie-1.4.1.min.js":1,"modules\/contextual\/contextual.js":1,"misc\/jquery.form.js":1,"sites\/all\/modules\/wysiwyg\/wysiwyg.init.js":1,"misc\/form.js":1,"misc\/ajax.js":1,"sites\/all\/modules\/jquery_update\/js\/jquery_update.js":1,"sites\/all\/modules\/comment_notify\/comment_notify.js":1,"sites\/all\/themes\/bluemasters\/js\/soundmanager2-nodebug-jsmin.js":1,"sites\/all\/themes\/bluemasters\/js\/mp3-player-button.js":1,"sites\/all\/themes\/bluemasters\/js\/inlineplayer.js":1,"2":1,"3":1,"4":1,"sites\/all\/themes\/bluemasters\/js\/jquery.mobilemenu.min.js":1,"sites\/all\/modules\/trtable_quiz\/trtable_quiz.js":1,"misc\/collapse.js":1,"misc\/progress.js":1,"public:\/\/js\/wysiwyg\/wysiwyg_ckeditor_uWMoMQ7qlhtyf-cFJlMTazsAxhCeS88weKBiAtXujAQ.js":1,"sites\/all\/libraries\/ckeditor\/ckeditor.js":1,"sites\/all\/modules\/wysiwyg\/editors\/js\/ckeditor-3.0.js":1,"sites\/all\/modules\/wysiwyg\/editors\/js\/none.js":1,"misc\/textarea.js":1,"modules\/filter\/filter.js":1,"5":1,"modules\/toolbar\/toolbar.js":1},"css":{"modules\/system\/system.base.css":1,"modules\/system\/system.menus.css":1,"modules\/system\/system.messages.css":1,"modules\/system\/system.theme.css":1,"modules\/contextual\/contextual.css":1,"sites\/all\/modules\/comment_notify\/comment_notify.css":1,"modules\/book\/book.css":1,"modules\/comment\/comment.css":1,"modules\/field\/theme\/field.css":1,"modules\/node\/node.css":1,"sites\/all\/modules\/quiz\/quiz.css":1,"modules\/search\/search.css":1,"modules\/user\/user.css":1,"sites\/all\/themes\/bluemasters\/css\/IPA.css":1,"sites\/all\/themes\/bluemasters\/css\/inlineplayer.css":1,"sites\/all\/modules\/ctools\/css\/ctools.css":1,"modules\/locale\/locale.css":1,"https:\/\/maxcdn.bootstrapcdn.com\/font-awesome\/4.7.0\/css\/font-awesome.min.css":1,"sites\/all\/modules\/eu_cookie_compliance\/css\/eu_cookie_compliance.css":1,"sites\/all\/modules\/adsense\/css\/adsense.css":1,"modules\/filter\/filter.css":1,"modules\/shortcut\/shortcut.css":1,"modules\/toolbar\/toolbar.css":1,"modules\/toolbar\/toolbar-print.css":1,"public:\/\/ctools\/css\/85760125e0b573c174141d9adf192778.css":1,"sites\/all\/themes\/bluemasters\/css\/960.css":1,"sites\/all\/themes\/bluemasters\/css\/720.css":1,"sites\/all\/themes\/bluemasters\/css\/481759.css":1,"sites\/all\/themes\/bluemasters\/css\/mobile.css":1,"sites\/all\/themes\/bluemasters\/css\/style.css":1,"sites\/all\/themes\/bluemasters\/css\/basic-layout.css":1}},"eu_cookie_compliance":{"cookie_policy_version":"1.0.0","popup_enabled":1,"popup_agreed_enabled":0,"popup_hide_agreed":0,"popup_clicking_confirmation":false,"popup_scrolling_confirmation":false,"popup_html_info":"\u003Cdiv class=\u0022eu-cookie-compliance-banner eu-cookie-compliance-banner-info eu-cookie-compliance-banner--categories\u0022\u003E\n  \u003Cdiv class=\u0022popup-content info\u0022\u003E\n        \u003Cdiv id=\u0022popup-text\u0022\u003E\n      \u003Cp\u003EWe use cookies on this site to enhance your user experience\u003C\/p\u003E\n              \u003Cbutton type=\u0022button\u0022 class=\u0022find-more-button eu-cookie-compliance-more-button\u0022\u003EGive me more info\u003C\/button\u003E\n          \u003C\/div\u003E\n          \u003Cdiv id=\u0022eu-cookie-compliance-categories\u0022 class=\u0022eu-cookie-compliance-categories\u0022\u003E\n                  \u003Cdiv class=\u0022eu-cookie-compliance-category\u0022\u003E\n            \u003Cdiv\u003E\n              \u003Cinput type=\u0022checkbox\u0022 name=\u0022cookie-categories\u0022 id=\u0022cookie-category-necessary\u0022\n                     value=\u0022necessary\u0022\n                     checked                     disabled \u003E\n              \u003Clabel for=\u0022cookie-category-necessary\u0022\u003ENecessary (normal website functioning)\u003C\/label\u003E\n            \u003C\/div\u003E\n                      \u003Cdiv class=\u0022eu-cookie-compliance-category-description\u0022\u003E\u003C\/div\u003E\n                  \u003C\/div\u003E\n                  \u003Cdiv class=\u0022eu-cookie-compliance-category\u0022\u003E\n            \u003Cdiv\u003E\n              \u003Cinput type=\u0022checkbox\u0022 name=\u0022cookie-categories\u0022 id=\u0022cookie-category-advertising\u0022\n                     value=\u0022advertising\u0022\n                                           \u003E\n              \u003Clabel for=\u0022cookie-category-advertising\u0022\u003EPersonalized advertisements\u003C\/label\u003E\n            \u003C\/div\u003E\n                      \u003Cdiv class=\u0022eu-cookie-compliance-category-description\u0022\u003E\u003C\/div\u003E\n                  \u003C\/div\u003E\n                          \u003Cdiv class=\u0022eu-cookie-compliance-categories-buttons\u0022\u003E\n            \u003Cbutton type=\u0022button\u0022\n                    class=\u0022eu-cookie-compliance-save-preferences-button\u0022\u003ESave preferences\u003C\/button\u003E\n          \u003C\/div\u003E\n              \u003C\/div\u003E\n    \n    \u003Cdiv id=\u0022popup-buttons\u0022 class=\u0022eu-cookie-compliance-has-categories\u0022\u003E\n            \u003Cbutton type=\u0022button\u0022 class=\u0022agree-button eu-cookie-compliance-default-button\u0022\u003EAccept all cookies\u003C\/button\u003E\n          \u003C\/div\u003E\n  \u003C\/div\u003E\n\u003C\/div\u003E","use_mobile_message":false,"mobile_popup_html_info":"\u003Cdiv class=\u0022eu-cookie-compliance-banner eu-cookie-compliance-banner-info eu-cookie-compliance-banner--categories\u0022\u003E\n  \u003Cdiv class=\u0022popup-content info\u0022\u003E\n        \u003Cdiv id=\u0022popup-text\u0022\u003E\n                    \u003Cbutton type=\u0022button\u0022 class=\u0022find-more-button eu-cookie-compliance-more-button\u0022\u003EGive me more info\u003C\/button\u003E\n          \u003C\/div\u003E\n          \u003Cdiv id=\u0022eu-cookie-compliance-categories\u0022 class=\u0022eu-cookie-compliance-categories\u0022\u003E\n                  \u003Cdiv class=\u0022eu-cookie-compliance-category\u0022\u003E\n            \u003Cdiv\u003E\n              \u003Cinput type=\u0022checkbox\u0022 name=\u0022cookie-categories\u0022 id=\u0022cookie-category-necessary\u0022\n                     value=\u0022necessary\u0022\n                     checked                     disabled \u003E\n              \u003Clabel for=\u0022cookie-category-necessary\u0022\u003ENecessary (normal website functioning)\u003C\/label\u003E\n            \u003C\/div\u003E\n                      \u003Cdiv class=\u0022eu-cookie-compliance-category-description\u0022\u003E\u003C\/div\u003E\n                  \u003C\/div\u003E\n                  \u003Cdiv class=\u0022eu-cookie-compliance-category\u0022\u003E\n            \u003Cdiv\u003E\n              \u003Cinput type=\u0022checkbox\u0022 name=\u0022cookie-categories\u0022 id=\u0022cookie-category-advertising\u0022\n                     value=\u0022advertising\u0022\n                                           \u003E\n              \u003Clabel for=\u0022cookie-category-advertising\u0022\u003EPersonalized advertisements\u003C\/label\u003E\n            \u003C\/div\u003E\n                      \u003Cdiv class=\u0022eu-cookie-compliance-category-description\u0022\u003E\u003C\/div\u003E\n                  \u003C\/div\u003E\n                          \u003Cdiv class=\u0022eu-cookie-compliance-categories-buttons\u0022\u003E\n            \u003Cbutton type=\u0022button\u0022\n                    class=\u0022eu-cookie-compliance-save-preferences-button\u0022\u003ESave preferences\u003C\/button\u003E\n          \u003C\/div\u003E\n              \u003C\/div\u003E\n    \n    \u003Cdiv id=\u0022popup-buttons\u0022 class=\u0022eu-cookie-compliance-has-categories\u0022\u003E\n            \u003Cbutton type=\u0022button\u0022 class=\u0022agree-button eu-cookie-compliance-default-button\u0022\u003EAccept all cookies\u003C\/button\u003E\n          \u003C\/div\u003E\n  \u003C\/div\u003E\n\u003C\/div\u003E\n","mobile_breakpoint":"768","popup_html_agreed":"\u003Cdiv\u003E\n  \u003Cdiv class=\u0022popup-content agreed\u0022\u003E\n    \u003Cdiv id=\u0022popup-text\u0022\u003E\n      \u003Cp\u003EThank you for accepting cookiesYou can now hide this message or find out more about cookies.\u003C\/p\u003E\n    \u003C\/div\u003E\n    \u003Cdiv id=\u0022popup-buttons\u0022\u003E\n      \u003Cbutton type=\u0022button\u0022 class=\u0022hide-popup-button eu-cookie-compliance-hide-button\u0022\u003EHide\u003C\/button\u003E\n              \u003Cbutton type=\u0022button\u0022 class=\u0022find-more-button eu-cookie-compliance-more-button-thank-you\u0022 \u003EMore info\u003C\/button\u003E\n          \u003C\/div\u003E\n  \u003C\/div\u003E\n\u003C\/div\u003E","popup_use_bare_css":false,"popup_height":"auto","popup_width":"100%","popup_delay":1000,"popup_link":"\/privacy","popup_link_new_window":1,"popup_position":null,"fixed_top_position":false,"popup_language":"en","store_consent":true,"better_support_for_screen_readers":0,"reload_page":0,"domain":"","domain_all_sites":0,"popup_eu_only_js":1,"cookie_lifetime":"100","cookie_session":false,"disagree_do_not_show_popup":0,"method":"categories","allowed_cookies":"","withdraw_markup":"\u003Cbutton type=\u0022button\u0022 class=\u0022eu-cookie-withdraw-tab\u0022\u003E\u003C\/button\u003E\n\u003Cdiv class=\u0022eu-cookie-withdraw-banner\u0022\u003E\n  \u003Cdiv class=\u0022popup-content info\u0022\u003E\n    \u003Cdiv id=\u0022popup-text\u0022\u003E\n          \u003C\/div\u003E\n    \u003Cdiv id=\u0022popup-buttons\u0022\u003E\n      \u003Cbutton type=\u0022button\u0022 class=\u0022eu-cookie-withdraw-button\u0022\u003E\u003C\/button\u003E\n    \u003C\/div\u003E\n  \u003C\/div\u003E\n\u003C\/div\u003E\n","withdraw_enabled":false,"withdraw_button_on_info_popup":0,"cookie_categories":["necessary","advertising"],"cookie_categories_details":{"necessary":{"weight":0,"machine_name":"necessary","label":"Necessary (normal website functioning)","description":"","checkbox_default_state":"required"},"advertising":{"weight":0,"machine_name":"advertising","label":"Personalized advertisements","description":"","checkbox_default_state":"unchecked"}},"enable_save_preferences_button":1,"cookie_name":"","cookie_value_disagreed":"0","cookie_value_agreed_show_thank_you":"1","cookie_value_agreed":"2","containing_element":"body","automatic_cookies_removal":1,"close_button_action":"close_banner"},"ajax":{"edit-check":{"wrapper":"trtable_quiz_multistep_form","callback":"trtable_quiz_multistep_form_ajax_callback","effect":"fade","event":"click","url":"\/system\/ajax","submit":{"_triggering_element_name":"op","_triggering_element_value":"Check"}}},"urlIsAjaxTrusted":{"\/system\/ajax":true,"\/basic-romanian-yes-no-and-exercises?lesson=10\u0026type=\u0026n=4607":true,"\/comment\/reply\/1148":true},"wysiwyg":{"ckeditor":{"timestamp":"rmu8v6"},"configs":{"ckeditor":{"formatfiltered_html":{"baseHref":"https:\/\/www.learnro.com\/","width":"auto","resize_minWidth":450,"theme":"default","skin":"moono","entities_latin":false,"entities_greek":false,"format_tags":"p;address;pre;h2;h3;h4;h5;h6;div","allowedContent":true,"contentsCss":["https:\/\/www.learnro.com\/themes\/seven\/reset.css?rmu8v6","https:\/\/www.learnro.com\/themes\/seven\/style.css?rmu8v6","https:\/\/www.learnro.com\/themes\/seven\/ie.css?rmu8v6","https:\/\/www.learnro.com\/themes\/seven\/ie7.css?rmu8v6","https:\/\/www.learnro.com\/themes\/seven\/ie6.css?rmu8v6"],"forcePasteAsPlainText":0,"language":"en","simple_source_formatting":0,"toolbarLocation":"top","resize_enabled":true,"toolbar":[["Bold","Italic"]]}}},"plugins":[],"disable":"Disable rich-text","enable":"Enable rich-text","ajaxToken":"a-onf-JoKHQHo-dylWngjFqrTl6MGIgW2ooB7J5jfnc","xss_url":"\/wysiwyg\/xss","triggers":{"edit-comment-body-und-0-value":{"field":"edit-comment-body-und-0-value","resizable":1,"activeFormat":"filtered_html","formatfiltered_html":{"editor":"ckeditor","status":1,"toggle":1}}}},"tableHeaderOffset":"Drupal.toolbar.height"});
//--><!]]>
</script></head><body class="jquery-ajax-load"><form action="/node/get/ajax/611,,95" method="post" id="trtable-quiz-multistep-form" accept-charset="UTF-8"><div><input type="hidden" name="form_build_id" value="form-jhpngzBYhUzAqKRKCWOeqH7HsMCz9_lqVn2WEVfMlOM" />
<input type="hidden" name="form_id" value="trtable_quiz_multistep_form" />
<div id="trtable_quiz_multistep_form"><div class="trtable-quiz form-wrapper" id="edit-quiz"><div class="header_content"><h3>Romanian Exercises: How do you say that you are not Romanian?</h3></div><p>Question 1 / 2</p><h4>What is the correct translation for:</h4><em style="color:blue;"><p><strong>I&#39;m not Romanian</strong> (male)</p></em><ul class="exercise_ul"><div id="edit-question-0" class="form-radios"><div class="form-item form-type-radio form-item-question-0">
 <input placeholder="" onBlur="lasttext=this;" onkeypress="if(event.keyCode==13){event.preventDefault();document.querySelector(&quot;#trtable_quiz_multistep_form input.trtable-quiz-forward-button&quot;).click();}" lang="ro" autocorrect="off" spellcheck="false" autocomplete="off" autocapitalize="off" type="radio" id="edit-question-0-1" name="question_0" value="1" class="form-radio" />  <label class="option" for="edit-question-0-1"><a class="sm2_link no_dl" href="/sites/default/files/Lessons/0.4/eu_nu_sunt_romanca.mp3"><strong>E</strong>u n<strong>u</strong> s<strong>u</strong>nt rom<strong>â</strong>ncă</a> </label>

</div>
<div class="form-item form-type-radio form-item-question-0">
 <input placeholder="" onBlur="lasttext=this;" onkeypress="if(event.keyCode==13){event.preventDefault();document.querySelector(&quot;#trtable_quiz_multistep_form input.trtable-quiz-forward-button&quot;).click();}" lang="ro" autocorrect="off" spellcheck="false" autocomplete="off" autocapitalize="off" type="radio" id="edit-question-0-0" name="question_0" value="0" class="form-radio" />  <label class="option" for="edit-question-0-0"><a class="sm2_link no_dl" href="/sites/default/files/Lessons/0.4/eu_nu_sunt_roman.mp3"><strong>E</strong>u n<strong>u</strong> s<strong>u</strong>nt rom<strong>â</strong>n</a> </label>

</div>
</div></ul><div id="quiz-message4230"></div><div id="edit-buttons" class="form-wrapper"><input class="next_button next_button1 trtable-quiz-forward-button form-submit" style="display: none" type="submit" id="edit-check" name="op" value="Check" /></div></div></div><div class="url-textfield"><div class="form-item form-type-textfield form-item-url">
  <label for="edit-url">Leave this field blank </label>
 <input autocomplete="off" type="text" id="edit-url" name="url" value="" size="20" maxlength="128" class="form-text" />
</div>
</div></div></form></body></html>

With this ajax call inserted when I click on the radio buttons within the multistepform brought by ajax, nothing happens, the multistep form ajax is not triggered. I'm trying to manually create the resources needed for the ajax within the multistep form to work. I guess that this is suboptimal. Could you please help me understand how can I add a minimum amount of javascript and css so that my multistep form would work with its own ajax calls. The very specific css and javascript of the multistep form I'll load them but the drupal ajax call within the multistep form, I do not know how to make it work.

id flag
The article you cited has some discussion: https://www.drupal.org/node/2046693/discuss
it flag
MMT
Thank you for letting me know. I read it, but I can't seem to find a solution for my issue. which comment do you refer to? Is it the one of 14 November 2013 at 00:22 with the following code ```(function ($) { Drupal.behaviors.myModule = { attach: function (context, settings) { jQuery("#ajax-target").bind('click', function(e) { $(this).load("/node/get/ajax/"+settings.myModule.nid); }); } }; }(jQuery));```
it flag
MMT
I spent quite some time, the ajax is added in the drupal_add_js function that is calling this function &drupal_static($name, $default_value = NULL, $reset = FALSE) { static $data = array(), $default = array(); if (isset($data[$name]) || array_key_exists($name, $data)) { if ($reset) { $data[$name] = $default[$name]; } return $data[$name]; } where the parameter $name = 'drupal_add_js'; The $data array contains all the ajax settings... I guess it's set elsewhere.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.