Hi All,
I have a ajax call in script like below -

function testMe()
{
 $.ajax({
                type: "POST",
                url: "http://3.84.46.104/tloken/test/testAjax.php",
//                data: "ajax=1&elem=" + elem+"&clicker="+clicker,
                data: "ajax=1",
                method: "POST",
                success: function (html) {
                        alert(html+' >>');
                        return false;
//                      var response = html.split('@'); 
//                    document.getElementById(elem).innerHTML = "";
                    document.getElementById('cmbxCategory').innerHTML = "";
                    document.getElementById('cmbxType').innerHTML = "";
                    document.getElementById('cmbxProvider').innerHTML = "";
                    //alert(response[0]+' >>'+response[1]+'>>'+response[2]);
//                    $('#'+elem).prepend(html.responseText);
                    $('#cmbxCategory').prepend(response[0]);
                    $('#cmbxType').prepend(response[1]);
                    $('#cmbxProvider').prepend(response[2]);
//                    return false;
                },
                error:  function(request, error){
                    console.log(arguments);
                    alert('>>'+arguments);
//                    return false;
                    }
            });
            return false;
        }

this testMe() is called on click of a button -

<button class="btn" id="1u" onClick="testMe(this.id, 1, 'cmbxCategory');">U</button>

And my testAjax.php page contains just a single line below -

<?php

echo 1; exit;


?>

jquery file is included already. despite this very simplistic approach this example does not work in firefox any version with the error in console as -

Error: NS_ERROR_NOT_AVAILABLE: prompt aborted by user
Source File: resource:///components/nsPrompter.js
Line: 425

Note : this is very simple representation of the actual scripts I have and this same example above doesnot work either in FF.While the same works nicely with internet explorer. I have created a seperate test pages like above.

would appreciate any suggestions this.

Member Avatar for diafol

I'm assuming that the url is not on a separate domain.

Why not use 'post'?

$('#1u').click(function(e)
{
    e.preventDefault();
    $.post('http://3.84.46.104/tloken/test/testAjax.php', {ajax: '1'})
    .done(function(data){
        alert(data);
    });
    .fail(function(){
        alert("Fail");
    });
});

Also, you can forget that inline call if the button is the only one that should call this routine. Else, you can shove the routine into a function and get the click handler to call that function.

Helli diafol, thank you for your response on this. I think it wouldnt make much difference either with jquery post or ajax directly.
But never mind I solved it already. The problem was it only needed 'return false;' at the right place.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.