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

  • SEARCH
  • Home
  • 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 3306538
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:18:01+00:00 2026-05-17T21:18:01+00:00

Not much knowledge about Javcascript beyond using it for some Dynamic HTML. Now I’m

  • 0

Not much knowledge about Javcascript beyond using it for some Dynamic HTML. Now I’m venturing a bit into Ajax ground and have a problem with the following code (borrowed from
http://kpumuk.info/php/ajax-enabled-smarty-plugins-part-2-ajax_form/ and edited to fit my needs).

How can I pass the update_id parameter to the obSubmit function?

var SmartyAjax = {

     submit: function(form, update_id, params, callback)
     {
       var myAjax = new Ajax.Request(
       form.action,
       {
         method: form.method,
         parameters: Form.serialize(form.id),
         onComplete: callback || this.onSubmit
       });
     },

     onSubmit: function(originalRequest)
     {
       var results = originalRequest.responseText;
       this.target = $("target2");
       this.target.innerHTML = results;
     }

}

I want to pass update_id to the function onSubmit so that I can assign it as the target. According to the Prototype documentation it gets the Ajax.Response object passed as the first parameter automatically. So, that’s what is referenced by originalRequest. I don’t see a way to pass update_id to that function as well. How do I do that?

On a related note: I see this “name: function(){}” syntax the first time. What is that? Is that needed because it creates methods of an object? A pointer to a simple explanation would be appreciated.

Thanks very much!

  • 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-17T21:18:02+00:00Added an answer on May 17, 2026 at 9:18 pm

    You need to call the function yourself from an anonymous wrapper (unless you want to modify the Prototype source, which I’d strongly suggest you avoid), like this:

     submit: function(form, update_id, params, callback)
     {
       var complete = callback || this.onSubmit;
       var myAjax = new Ajax.Request(
       form.action,
       {
         method: form.method,
         parameters: Form.serialize(form.id),
         onComplete: function(req) { complete.call(this, req, update_id); }
       });
     },
    

    Now your handler will have a second argument, the update_id parameter passed into this function, for example you could do this:

    onSubmit: function(originalRequest, update_id) {
      alert(update_id);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Probably not much more to elaborate on here - I'm using a NumericStepper control
This is something I'm not much consistent about and always curious about what other
I'm sorry for this very newbish question, I'm not much given into web development.
I'm reading some tutorials now about jQuery.. function creating,plugin creation etc. but these tutorials
I'm not much of a Visual Basic person, but I am tasked with maintaining
As far as I know (not much I'll admit), the currently popular programming paradigms
Here's the code. Not much to it. <?php include("Spreadsheet/Excel/Writer.php"); $xls = new Spreadsheet_Excel_Writer(); $sheet
In an AI application I am writing in C++, there is not much numerical
I have not seen much support for Grails to develop facebook apps.I was just
This question is not so much programming related as it is deployment related. I

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.