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 7911503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:16:27+00:00 2026-06-03T13:16:27+00:00

Hi regarding https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/function-declarations.html I define my JS function like this <script language=javascript> var clearMessage

  • 0

Hi regarding https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/function-declarations.html I define my JS function like this

<script language="javascript">
    var clearMessage = function ClearMessage() {
        $("#result").html("");
    };
</script>

And I try to call it in OnBegin method from MVC ajax,

@using (Ajax.BeginForm(new AjaxOptions() { HttpMethod = "post", OnBegin = "ClearMessage" }))

But I getting error that function not exit,
how to call my function that described by this best practice ? (without var clearMessage evering working correct)

  • 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-06-03T13:16:31+00:00Added an answer on June 3, 2026 at 1:16 pm

    Never seen such syntax. Don’t even know if it is valid javascript.

    Try defining your function like this:

    <script type="text/javascript">
        var ClearMessage = function() {
            $("#result").html("");
        };
    </script>
    

    or like this (which is pretty much the same):

    <script type="text/javascript">
        function ClearMessage() {
            $("#result").html("");
        };
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was looking through some code from a firefox extension (here: https://github.com/mozilla/prospector/blob/master/oneLiner/bootstrap.js#L34 ) and
I'm reading some source code at https://github.com/plataformatec/devise and found that line of code: class_eval
I reading Rails Tutorial and created a Sample_App. My code is available here: https://github.com/namic/sample_app
Using ROAR ( https://github.com/apotonick/roar ) and without using ActiveRecord or any view-templates I want
While reading the spree source code via the official code repository on Github, https://github.com/spree/spree
I've been reading over the moustache documentation, and it looks cool: https://github.com/defunkt/mustache There is
I'm trying to install rvm.el from https://github.com/senny/rvm.el and after copying said file and copying
I was reading http://github.github.com/github-flavored-markdown/ I would like to implement that Newline modification in PHP
I am following the guidelines published here: http://develop.github.com/p/repo.html I am trying to add a
Sorcery authentication gem: https://github.com/NoamB/sorcery Sorcery's creator provides an example Rails app with Sorcery test

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.