Mam prosty skrypt i dziennik mi coś wyrzuca, jak się okazuję skrypt PHP został wykonany poprawnie (Wszystkie funkcję PHP działają - testowane ) lecz skrypt JS (Ajax) kończy pracę i przechodzi do funkcji error,
kod ajax:
$("#find").click(function(){
var phrase = $("#phrase").val();
//$("#list").animate({opacity: 0},2000);
$.ajax({
type : "POST",
url : "data-func.php",
data : {
func : 'find',
phrase: phrase
},
success : function(data) {
$("#list").html(data);
console.log("great");
//$("#list").animate({opacity: 1},2000);
},
complete : function(r) {
},
error: function(error) {
console.log(error);
}
});
A to element kodu który wykonuje sięw PHP:
if(isset($_POST['func'])){
switch($_POST['func']){
case "find":
$titles = findLines($_POST['phrase']);
$view.= '<ul>';
foreach($titles as $element){
$view.= '<a href="index2.php?id='.$element->id.'"><li><img src="/images/teczka.png" style="width:16px;height:16px;margin:0px 10px 0px 10px ">'.$element->post_title.'</li></a>';
}
$view.='</ul>';
echo $view;
break;
case "updatepost":
//...............
break;
}
}
Zaś firefoxowy dziennik wywala mi to:
Object { readyState: 0, getResponseHeader: .ajax/jqXHR.getResponseHeader(), getAllResponseHeaders: .ajax/jqXHR.getAllResponseHeaders(), setRequestHeader: .ajax/jqXHR.setRequestHeader(), overrideMimeType: .ajax/jqXHR.overrideMimeType(), statusCode: .ajax/jqXHR.statusCode(), abort: .ajax/jqXHR.abort(), state: .Deferred/promise.state(), always: .Deferred/promise.always(), then: .Deferred/promise.then(), 11 więcej… } ajax-func.js:22:4
22 linia to ta w której jest wywołana funkcja wyświetlająca error :/.
Co jest nie tak ?