ozkank
ozkank

Reputation: 1462

JQuery postback doesn't work

I've a function like this;

    <script type="text/javascript">            
        function callUrl(url) {       
            $.post(url);
            alert('You'll redirect a telephone');
        }        
    </script>

I'm only want to work url. When the url'll worked, the user call a telephone. I'm correctly getting url. But $.post(url); doesn't work. How do you solve this?

Upvotes: 1

Views: 258

Answers (3)

daniel_aren
daniel_aren

Reputation: 1924

You need to write "success"

 $.ajax({
  url: "test.html",
  success: function(){
  alert("");
  }
});

Upvotes: 0

Vikram
Vikram

Reputation: 8333

you need to encode url use encodeURIComponent function

<script type="text/javascript">            
        function callUrl(url) {       
            $.post(encodeURIComponent(url));
            alert('You\'ll redirect a telephone');
        }        
    </script>

Upvotes: 0

Checksum
Checksum

Reputation: 3240

Pass a success handler to the $.post method to perform your callbacks.

$.post(url, function(data) {
   // Call the phone here
});

Upvotes: 1

Related Questions