Skip to content

Instantly share code, notes, and snippets.

@prashantdsala
Created April 12, 2023 07:06
Show Gist options
  • Save prashantdsala/654e42741a0233b50470face5818013e to your computer and use it in GitHub Desktop.
Save prashantdsala/654e42741a0233b50470face5818013e to your computer and use it in GitHub Desktop.
Drupal - AJAX request using Drupal ajax and get response
$.ajax({
url: '/myurl/ajax',
type: 'POST',
data : {
title: title,
type : type,
target: target,
view : view,
display:display
},
success:function(response) {
var ajaxObject = Drupal.ajax({
url: "",
base: false,
element: false,
progress: true
});
// Simulate an AJAX response having arrived, and let the Ajax
// system handle it.
ajaxObject.success(response);
$(target).show();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment