tags:

views:

53

answers:

1

I've been using ajax functions like $.post() using jQuery 1.3.2 and was successfull till today, when I switched to v1.4.2 after downloading jquery UI (jquery-ui-1.8.5.custom.min.js) for using jQuery UI's radio buttons ($( "#radio" ).buttonset();), which wasn't working with the my version (it said .buttonset()is not defined).
After switching to the new version, it seems the callback in $.post is not working. The call is made (i see response in firebug)
Can somebody tell me what is wrong and how to fix it? Please tell me if more information is needed. I haven't added any code as I think it's not a coding error.
Thanks

EDIT
This is my code...

<script language="javascript" src="jquery-1.4.2.js"></script>
<script language="javascript" src="jquery-ui-1.8.5.custom.min.js"></script>
</head>

<body>
<script>
function get() {
    $.post("php.php",{arg:"post"},
           function (data) {
               alert(data);
           });
}
</script>
<input type="button" value="Click" onclick="get()" />

and php:

<?php
    if ( $_SERVER['REQUEST_METHOD'] == 'POST') {
        die('post');
    } else {
        die('get');
    }
?>
A: 

What's the content-type sent in response header from your server? I was able to reproduce it here http://jsfiddle.net/F58Yu/4/ by forcing text/xml as response content-type and invalid XML as content.

Not with any other types though.. With no dataType set that is.

function get() {
$.post("/echo/xml/",{xml:"<test>a/test>"},
       function (data) {
           alert(data);              
           console.log("Returned");
           console.dir(data);
       });

}​

The address and POST-data is a feature of jsfiddle for testing ajax, does what I described.

Alexander Sagen