![]() |
| |||||||
| Home | Register | Blogs | FAQ | Members List | Calendar | Downloads | Arcade | Mark Forums Read |
| Web Development Java/PHP/Perl/ASP and more |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 |
| Web developer | JavaScript problem with variables-functions in AJAX ( jQuery ) I need to check same login verification submitted from form with help of AJAX/jQuery Here is the sources ( jQuery file is not included ) main.html Code: <script type="text/javascript" language="javascript" src="jquery.js"></script>
<script language="JavaScript" type="text/javascript">
function verif()
{
var myErr = '';
var f = document.f1reg;
myErr+=" * Fill in all required fields.\n";
$.ajax({
type: "POST",
url: "checkusername.php",
data: "username="+ f.username.value,
success: function(msg){
if (msg == "1"){
myErr+=' * User with such login already exists.\n';
//alert(myErr); Label 1
}
}
});
//alert(myErr); Label 2
if (myErr!='') {
alert('The following information is incorrect:\t\t\t\t\t\n\n'+myErr); // Label 3
}
return (myErr=='');
}
</script>
<form action="action.php" method="post" name="f1reg" id="f1reg" onsubmit="return verif();">
Login: <input type="text" id="username" name="username" value="" tabindex="1" />
<input type="submit" name="submit" value="Submit" />
</div>
</form> The problem is the following: On Label 1, myErr adds an error message to the list On Label 2, myErr looses the latest message and just shows " * Fill in all required fields.\n"; On Label 3, the same situation as in Label 2 But if I remove Label 2 comment, and alert any message in that part of code, the script starts to working well. What is the problem? |
| | |
| | #2 |
| йес эм эли... | inchqan haskaca, problem@ sranic e. browser@ ajax zapros e uxarkum, bayc chi spasum vor checkusername.php -ic return ani, and minchev ed request@ sksum e gnal, inqe arag ancnum e hajord gorcoxutyane... sax JSn arag ashxatum e, u PHPic chi hascnum stanal variable ev kpcnel myErr -in. erp label2 -um alert es anum, script@ cuyc e talis et alerti window-@ and kangnum e. ed kangnac vaxt karox a ga PHP-ic qo variablen and kpni myErr -in, u label 3 um arden normal php'ic return exac string unenas. script@ arden petq e sharunakel function(msg) -i mej, vor return exac lini php'n... husov em chisht and haskanali er... ![]()
__________________ իմ լաստը | իմ ֆկանտակտը | իմ տունը | ես.սեքսի.եմ --- www.imagger.com - Free Image Hosting System www.armblogs.info, www.file.am, www.imageshare.am, www.softportal.am, www.marshrut.info Last edited by Mesrop : Mar 24, 2008 at 14:47. Reason: avelacum |
| | |
| | #3 |
| Web developer | Haskanalin - haskanalia, bayc de es @tenc liq@ ktorner unem, voric petq e sborka arvi u resultiruyushiy error ta. Aysinqn es chem karoghana menak 1 tvyal-i stugman jamanak verjnakan result@ cuic tam. Erevi xndir@ aveli global senc tam, vonc karelia Ajax-ov stugel inch vor DB-ic tvyal u dra result@ poxancel inch vor mi JS-i popoxakanin? |
| | |
| | #4 |
| йес эм эли... | de script@ parberabar petq e pause lini, and server request ani... uxaki amen requestic heto coden piti sharunakes success: function(msg){} -i mejic...orinak success: function(msg){check2();} ... isk vapshe ed depqum imho aveli chisht klini vor 1 zaprosov sax stuges. aysinqn 1 zaprosov uxarkes fieldneri valuenere PHPin, and 1 array'ov return anes from PHP bolor errornere irar het JS variablei mej.
__________________ իմ լաստը | իմ ֆկանտակտը | իմ տունը | ես.սեքսի.եմ --- www.imagger.com - Free Image Hosting System www.armblogs.info, www.file.am, www.imageshare.am, www.softportal.am, www.marshrut.info |
| | |
| | #5 |
| Web developer | Mersi Mesrop. Kporcenq takic durs ganq. |
| | |
| | #6 |
| dardanian Join Date: Nov 2005 Location: new troy
Posts: 173
Rep Power: 3 Reputation:
10 | qo request-@ serverin XMLHttpRequest (IE -i hamar el ActiveXObject(....)) object-i mijocov petq a anes. Mesrop -@ &isht a asum, qo js-@ petq a spasi request-i patasxanin server-ic. onreadystatechange event handler-@ ogtagortsi u stugi readyState -i arjeq@ (yete &isht em hishum, request-d complete a yerb vor readyState=4). readyState-i myus arjeqner@ (u @ndhnrapes ajax-db query -in veraberogh mi vagon urish info) internet-um karas gtnel ![]()
__________________ o gloriose stelle, o lume pregno di gran virtù, dal quale io riconosco tutto, qual che si sia, il mio ingegno dante, paradiso - canto 22 |
| | |
| | #7 | |
| Web developer | Quote:
![]() | |
| | |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| NHibernate: Problem with Configuration | Intel | Languages, Compilers and Interpreters | 0 | Mar 4, 2007 07:49 |
| JavaScript - Frames problem | Aram Ghazanchyan | Web Development | 9 | Jun 2, 2003 05:43 |
| JavaScript Encoding Problem | Viktor Abovian | Web Development | 2 | Nov 1, 2002 13:30 |
| static variables in class member functions | hov | Languages, Compilers and Interpreters | 6 | Sep 23, 2002 19:18 |
| static variables in class member functions | hov | Languages, Compilers and Interpreters | 0 | Sep 21, 2002 09:33 |