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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:37:10+00:00 2026-05-16T02:37:10+00:00

In bottom of my index.php I have a Javascript function between paired <script> tags.

  • 0

In bottom of my index.php I have a Javascript function between paired <script> tags. I have a click handler that calls the function that makes a Prototype.js Ajax request.

This version does not work (no request is made), although the myFunction itself is called.

function myFunction(fr, fw) {
    new Ajax.Request('/ascript', {
        method: 'post',
        parameters: { a: fr, b: fw }, 
        onSuccess: function(transport) { }, 
        onFailure: function(request) { }
    });
}

However when I add the alert(“something”); line the ascript php script is called.

function myFunction(fr, fw) {
    new Ajax.Request('/ascript', {
        method: 'post',
        parameters: { a: fr, b: fw }, 
        onSuccess: function(transport) { alert("here"); }, 
        onFailure: function(request) { }
    });
}

Might it be some weird whitespace problem? Is there an error in my syntax?

  • 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-16T02:37:11+00:00Added an answer on May 16, 2026 at 2:37 am

    So I’ve found the problem. The problem was in how I added the eventhandler to my “button”

    Initially (on both examples given in my question) I had:

    echo "<a href='' ><p id='button' onclick='myFunction(" .$a .", " .$b.");'>Click</p></a>";
    

    The surrounding <p> with a link tag was ofcourse a bad idea …

    This works:

    echo "<a href='' onClick='Event.stop(event);'><p id='button' onclick='myFunction(" .$a .", " .$b .");'>Click</p></a>";
    

    Thanks to all for your answers. I guess the moral of the story is, look eaven farther from the Javascript itself, look where it gets called and what could be broken there.

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

Sidebar

Related Questions

i have following lines included at the bottom of my index.php: <script type=text/javascript language=javascript
I've found out that my web pages (mainly index.php, main.html, include.inc) have been injected
I have slightly simplified the default index.php file supplied with WAMP, so that it
I have a page name index.php. And I have a script variable as follows
I have a page (index.php) that pulls posts from mysql database. The posts are
I have this piece of code on a php page, at the bottom: window.opener.location.href=/index.html;
I have the following structure: -uploadpage.html -index.php -resources -jquery-1.4.2.min.js On my index.php, I get
I have a very simple hover function that appears to work fine in everything
I have a simple menu: <ul id=menu2> <li> <a href=index.php?id=home>Home</a></li> <li> <a href=index.php?id=about>About us</a></li>
I have a script that changes images on hover. It works on all images

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.