Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6749095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:38:56+00:00 2026-05-26T12:38:56+00:00

$delete_commant = l(t(‘X’), $url, array(‘attributes’ => array(‘onclick’ => ‘return call_ajax(123)’))); when i put alert

  • 0

$delete_commant = l(t(‘X’), $url, array(‘attributes’ =>
array(‘onclick’ => ‘return call_ajax(123)’)));

when i put alert in call_ajax function definition, it is alerted, so i proceed to write the ajax post method, but when i click the link page getting refresh,

How to implement ajax in drupal

function call_ajax(str){alert(str);
    var url = "post.php";
    var params = "lorem=ipsum&name=binny";
    http.open("POST", url, true);

    //Send the proper header information along with the request
    http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    http.setRequestHeader("Content-length", params.length);
    http.setRequestHeader("Connection", "close");

    http.onreadystatechange = function() {//Call a function when the state changes.
        if(http.readyState == 4 && http.status == 200) {
            alert(http.responseText);
        }
    }
    http.send(params);  
     }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:38:57+00:00Added an answer on May 26, 2026 at 12:38 pm

    drupal uses jquery by default. So why not just implement this call using http://api.jquery.com/jQuery.ajax/.

    Other techniques involve using the form_api like the ahah : http://api.drupal.org/api/drupal/developer–topics–forms_api_reference.html/6#ahah

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Funny thing is that if i delete the comment for alert(data[i].id) the code works.
I have the following function that deletes the LaTeX command surrounding the current cursor
I have a similar problem with delete command too.. function deleteUsers($userID) { foreach($userID as
I am creating a web user control for showing Alert on AspxGridView Columns(Delete/Edit) click
Say I am in the delete_user() function in the user model, and I want
If i create a heap array inside a loop, do i have to delete
Has anyone tried out working with the Delete and update command of SPDataSource used
I want to delete a directory in the repository via command line. At the
I have to delete a versioned file my bzr repository using bzr remove command.
I have a datalist with a OnDeleteCommand=Delete_Command. I want the delete a record with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.