Skip to main content

JQuery success callback isn't being called or?



I have searched a lot of threads but i can't find any answer that suits me. Now I will try to explain my problem.





I have a simple jQuery script that does a little ajax request. its simple like this:







print("

<script>

function buscaCaracteristicas(idTotalizador){

var target = '../../ajax/doSomeSearch.php';

$.ajax({

url: target,

//dataType: 'html',

dataType: 'text',

type: 'POST',

success: function(msg){

alert(msg);

}

});

}

</script>

");







And the PHP page does this:







<?php

$ret = "<p>hello world</p>";

exit($ret);

?>







I have tried putting the return data on an HTML element via $.html(msg) too. Problem is: alert or the $.html() on callback NEVER fires although on firebug I can check the request has the return code 200 OK.





Notice that the function code is wrapped into a PHP print("") command and the return dataType is HTML which is what I really need to get (can't use JSON).





Any miraculous advice? Thanks in advance.





Solved: changing dataType to 'text' according to Splash-X advices it worked.


Comments

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?