protected function NgLightboxTest::simplePostAJAX in NG Lightbox 7
We have a light-weight implementation of drupalPostAJAX() that works without requiring a form.
Parameters
string $path: The Drupal path to post to.
$post_array: The array of post data.
Return value
array The array of AJAX commands returned.
1 call to NgLightboxTest::simplePostAJAX()
- NgLightboxTest::testNgLightbox in tests/
ng_lightbox.test - Test the basic usage and settings.
File
- tests/
ng_lightbox.test, line 166 - NG Lightbox tests.
Class
- NgLightboxTest
- @file NG Lightbox tests.
Code
protected function simplePostAJAX($path, $post_array) {
$out = $this
->curlExec(array(
CURLOPT_URL => url($path, array(
'absolute' => TRUE,
)),
CURLOPT_POST => TRUE,
CURLOPT_POSTFIELDS => $post_array,
CURLOPT_HTTPHEADER => array(),
));
$this
->verbose('POST request to: ' . $path . '<hr />Ending URL: ' . $this
->getUrl() . '<hr />Fields: ' . highlight_string('<?php ' . var_export($post_array, TRUE), TRUE) . '<hr />' . $out);
return drupal_json_decode($out);
}