am asa:
in fisierul fisier.js
Cod: Selectaţi tot
$(document).ready(function(){
$(function(){
$('input#addbanc').click(function(){
var categorie = $('#categorie').val();
var banc = $('#banc').val();
var categorie = document.getElementById('categorie').value;
var banc = document.getElementById('banc').value;
$('.statusadaugareloading').show();
$('.statusadaugaredelogat').hide();
$('.statusadaugareerror').hide();
$('.statusadaugareeror').hide();
$('.statusadaugareerorr').hide();
$('.statusadaugareerorrr').hide();
$('.statusadaugaresucces').hide();
if(categorie.length < 3)
{
$('.statusadaugareloading').hide();
$('.statusadaugaredelogat').hide();
$('.statusadaugareerror').show();
$('.statusadaugareeror').hide();
$('.statusadaugareerorr').hide();
$('.statusadaugareerorrr').hide();
$('.statusadaugaresucces').hide();
}
else if(banc.length < 10)
{
$('.statusadaugareloading').hide();
$('.statusadaugaredelogat').hide();
$('.statusadaugareerror').hide();
$('.statusadaugareeror').show();
$('.statusadaugareerorr').hide();
$('.statusadaugareerorrr').hide();
$('.statusadaugaresucces').hide();
}
else { $.ajax({
url:'/addbanc.php?bancuri&categorie='+categorie+'&banc='+banc,
type: "POST",
Async: false,
cache: false,
success:function(data_response){
if(data_response == 'exista') {
$('#categorie').val('');
$('#banc').val('');
$('.statusadaugareloading').hide();
$('.statusadaugaredelogat').hide();
$('.statusadaugareerror').hide();
$('.statusadaugareeror').hide();
$('.statusadaugareerorr').show();
$('.statusadaugareerorrr').hide();
$('.statusadaugaresucces').hide();
}
else if(data_response == 'datele nu sau adaugat') {
$('#categorie').val('');
$('#banc').val('');
$('.statusadaugareloading').hide();
$('.statusadaugaredelogat').hide();
$('.statusadaugareerror').hide();
$('.statusadaugareeror').hide();
$('.statusadaugareerorr').hide();
$('.statusadaugareerorrr').show();
$('.statusadaugaresucces').hide();
}
else if(data_response == 'banc adaugat') {
$('#categorie').val('');
$('#banc').val('');
$('.statusadaugareloading').hide();
$('.statusadaugaredelogat').hide();
$('.statusadaugareerror').hide();
$('.statusadaugareeror').hide();
$('.statusadaugareerorr').hide();
$('.statusadaugareerorrr').hide();
$('.statusadaugaresucces').show();
}
else if(data_response == 'delogat') {
$('#categorie').val('');
$('#banc').val('');
$('.statusadaugareloading').hide();
$('.statusadaugaredelogat').show();
$('.statusadaugareerror').hide();
$('.statusadaugareeror').hide();
$('.statusadaugareerorr').hide();
$('.statusadaugareerorrr').hide();
$('.statusadaugaresucces').hide();
}
}
});
};
});
});
});
Cod: Selectaţi tot
formularul +
<div class="statusadaugareloading" style="display:none;">
<center><img class="loading" src=/imagini/stare-loading.gif>
<font color=orange>Te rugam asteapta!</font>
</center>
</div>
<div class="statusadaugareerror" style="display:none;">
<center><img class="error" src=/imagini/stare-error.png>
<font color=red>Alege categoria bancului!</font>
</center>
</div>
<div class="statusadaugareeror" style="display:none;">
<center><img class="error" src=/imagini/stare-error.png>
<font color=red>Scrie un banc, bancul trebuie sa contina minim 10 caractere!</font>
</center>
</div>
<div class="statusadaugareerorr" style="display:none;">
<center><img class="error" src=/imagini/stare-error.png>
<font color=red>Acest banc exista deja pe site! Adauga altul!</font>
</center>
</div>
<div class="statusadaugareerorrr" style="display:none;">
<center><img class="error" src=/imagini/stare-error.png>
<font color=red>S-a intamplat ceva de nu sa putut adauga bancul, da un F5 la pagina sau revin-o in cateva minute!</font>
</center>
</div>
<div class="statusadaugaresucces" style="display:none;">
<center><img class="succes" src=/imagini/stare-succes.png>
<font color=green>Bancul a fost adaugat si este deja vizibil.
Intre timp poti sa mai adaugi si alte bancuri!</font>
</center>
</div>
<div class="statusadaugaredelogat" style="display:none;">
<center><img class="error" src=/imagini/stare-error.png>
<font color=red>Pentru a putea adauga un banc trebuie sa fi inregistrat
si logat pe site!</font>
</center>
</div>
din fisierul addbanc raspunsurile sunt :
banc adaugat
delogat
Datele nu s-au adaugat.
Unde am gresit? l-am refacut de 10 ori, acelasi rezultat