Problems with window.location in confirm box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gopalsareen
    New Member
    • Jun 2013
    • 1

    Problems with window.location in confirm box

    i have created a code which post a uid to a different server on confirm dialog click and on button click it works fine the code below

    for confirm box:

    Code:
    function andpop()
    {
    var qes   = confirm( " " );
    if ( qes )
    clicked( '1135' );
    }
    Button:
    Code:
    input type="button" value="click" onClick="return clicked('1135');">
    but i also want to redirect to another page when i click confirm or button,so i changed the code with

    confirm box:
    Code:
    function andpop()
    {
    var qes   = confirm( " " );
    if ( qes )
    window.location ="buf";
    clicked( '1135' );
    }
    Button:
    Code:
    <a href="www.google.com"><input type="button" value="click" onClick="return clicked('1135');"></a>
    but now its not working it showing error

    the code using for posting data:
    Code:
            function clicked( uid ) {
            $.ajax({
                url:    'http://example.com/jquery/member/count.php',
                type: 'GET',
                data:   'uid='+uid,
                dataType:   'jsonp',
                jsonp:  false,
                jsonpCallback:  'methodCallback',
                success: function( data ) {
                    if( data.message == "yes" ) {
                        alert("d");
                    } else {
                        alert( "failed, maybe uid its not exists in database" );
                    }
    
    
                },
                error: function( Request, error ) {
                    alert( error );
                }
            });
        }
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    I don't understand the purpose of the AJAX call if you're going to redirect the user before the AJAX call.

    Comment

    Working...