Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Senior Coder o0O0o.o0O0o's Avatar
    Join Date
    Jan 2008
    Location
    C:\Windows\System32
    Posts
    1,018
    Thanks
    19
    Thanked 9 Times in 9 Posts

    javascript function not working

    hi ,


    Code:
    function markpayment(orderNumber)
    {
    	
    alert();
    	
    	
    }

    this is not working

    PHP Code:
    onclick='javascript:markpayment('".$ordernum."_tick');' 
    but this is working


    PHP Code:
    onclick='javascript:markpayment(".$ordernum.");' 
    Please de-reputate me
    © 0o0o0o0

    Its better to rule in Hell then to serve in Heaven

  • #2
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    it does not matter what it looks like in php...as long as some valid html is generated it will work...you have to show us the generated the html or the complete echo statement from php
    You never have to change anything you got up in the middle of the night to write. -- Saul Bellow

  • #3
    Senior Coder o0O0o.o0O0o's Avatar
    Join Date
    Jan 2008
    Location
    C:\Windows\System32
    Posts
    1,018
    Thanks
    19
    Thanked 9 Times in 9 Posts
    I saw the html it was

    Code:
    markpayment('23434_tick')
    it was not working

    but

    Code:
    markpayment(23434)
    was working

    I think problem was when i added tick with it . I later on concatenated tick in the function and then it worked but not when i joined it with in function arguments
    Please de-reputate me
    © 0o0o0o0

    Its better to rule in Hell then to serve in Heaven

  • #4
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    Quote Originally Posted by o0O0o.o0O0o View Post
    Code:
    markpayment('23434_tick')
    it was not working
    but
    Code:
    markpayment(23434)
    was working
    they're both no different and should work...maybe you are looking in the wrong place...are you sure there isn't some validation that checks if the incoming argument is an integer or something?
    You never have to change anything you got up in the middle of the night to write. -- Saul Bellow

  • #5
    Regular Coder
    Join Date
    Jan 2008
    Location
    Willow Grove, PA
    Posts
    169
    Thanks
    1
    Thanked 27 Times in 27 Posts
    Change:
    Code:
    function markpayment(orderNumber) {
    	alert(orderNumber);
    }
    The problem is that the browser sees the onclick event as markpayment( not onclick='markpayment('23434_tick')' because of how many quotes you have.

    Change the output so that it looks like:

    Code:
    onclick="markpayment('23434_tick')"


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •