Created
March 28, 2014 00:55
-
-
Save m7v/9822696 to your computer and use it in GitHub Desktop.
Hook_js (provided module JS)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_js(). | |
*/ | |
function spaint_cache_js() { | |
$items = array(); | |
require_once DRUPAL_ROOT . '/includes/path.inc'; | |
$items['user_data'] = array( | |
'callback' => 'user_data', | |
'bootstrap' => DRUPAL_BOOTSTRAP_SESSION, | |
'page arguments' => array(1, 2, 3), | |
); | |
return $items; | |
} | |
//If you need to call js-callback use AJAX and next URL-scheme | |
// js/{module}/{callback}/{page_arguments} | |
$.ajax({ | |
type: 'GET', | |
url: '/js/spaint_cache/user_data/' + language + '/' + uid + '/' + nid, | |
success: function (data) { | |
Spaint.attachActualData(data, uid, context, settings); | |
iambusy.stop(); | |
}, | |
dataType: 'json' | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment