Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pengumpulan Tugas Besar 2 IF3110 Pemrograman Berbasis Web #16

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
43a3fdf
Create MEMBER.md
willyfh Nov 16, 2013
038f217
Servlet Untuk Login
willyfh Nov 16, 2013
602395e
add web.xml
willyfh Nov 16, 2013
62cc0a4
add class connectionmanager, userbean, userdao
willyfh Nov 16, 2013
5438eb9
Coba.class ,Coba.java( helloworld)
willyfh Nov 16, 2013
29a21c5
add mysql-connector-java & servlet-api
willyfh Nov 16, 2013
60c8309
Ajax Login
willyfh Nov 16, 2013
3cf3a9b
UPDATE LoginServlet, UserBean, UserDAO
willyfh Nov 16, 2013
cd62d50
Update LoginServlet
willyfh Nov 16, 2013
af765e0
Add logout.jsp
willyfh Nov 16, 2013
cdc8534
add index.jsp,header.jsp, folder res (css,img,js)
willyfh Nov 16, 2013
92236f6
add db
willyfh Nov 16, 2013
384db2f
Update LoginServlet
willyfh Nov 20, 2013
3773864
Update UserBean
willyfh Nov 20, 2013
f701eca
Update index.jsp
willyfh Nov 20, 2013
9075ea6
Update Header.jsp
willyfh Nov 20, 2013
23aeaee
Update UserDAO
willyfh Nov 20, 2013
ba9393e
Update web.xml
willyfh Nov 20, 2013
41f4448
Add servlet & jsp Registrasi
willyfh Nov 20, 2013
7246c93
Add servlet & jsp Registrasi Credit Card
willyfh Nov 20, 2013
15b570b
Add servlet & jsp edit-profile
willyfh Nov 20, 2013
b222d2c
Update database.sql
willyfh Nov 21, 2013
bd64985
Update Bean, DAO, web.xml, index.jsp
willyfh Nov 21, 2013
8e8431c
ADD image
willyfh Nov 21, 2013
96fa3e8
ADD bestbuy
willyfh Nov 21, 2013
4894283
edit bean, dao, web xml, header, index, style
willyfh Nov 21, 2013
473a9d8
add barang.class
willyfh Nov 21, 2013
9ee25b7
ADD image
willyfh Nov 21, 2013
9278882
ADD search jsp & search
willyfh Nov 21, 2013
a8dc21a
Update search.jsp
willyfh Nov 21, 2013
8fa3f9c
ADD semua file javanya
willyfh Nov 23, 2013
aa049ff
product+detail product(belum add to chart)
dyahrahma Nov 24, 2013
e1098a2
edit search.jsp search servlet
willyfh Nov 26, 2013
d797b48
edit popup.js
willyfh Nov 26, 2013
7221e7c
shoppingbag blum difixin
dyahrahma Nov 26, 2013
1d535c0
Merge branch 'master' of https://github.com/willyfh/IF3110-Tubes-II
dyahrahma Nov 26, 2013
01b8f2f
Update Login, bean, web.xml, header,style, common
willyfh Nov 26, 2013
2384cac
Merge branch 'master' of https://github.com/willyfh/IF3110-Tubes-II
willyfh Nov 26, 2013
446f6c3
edit web.xml
willyfh Nov 26, 2013
fcaae2a
ADD modul admin ( delete, add, edit)
willyfh Nov 26, 2013
be2bd3f
update database.sql
willyfh Nov 26, 2013
554f583
EDIT
willyfh Nov 26, 2013
3775eea
ADD validation edit barang
willyfh Nov 26, 2013
6299248
ADD folder docs
willyfh Nov 26, 2013
7ec5f87
no message
willyfh Nov 26, 2013
e2e9a47
Create INSTALL.md
willyfh Nov 26, 2013
7e93c12
Update MEMBER.md
willyfh Nov 26, 2013
f078e6e
Update INSTALL.md
willyfh Nov 26, 2013
c1e5f73
Update MEMBER.md
willyfh Nov 26, 2013
94cd45a
UPDATE edit-profile & registrasi
willyfh Nov 26, 2013
9df8d24
Validasi HTML5 halaman admin, creditcard, edit-profile,registrasi,search
willyfh Nov 26, 2013
4e511f4
UPDATE ngerapiin & sekaligus menuhin spek
willyfh Nov 27, 2013
bb58774
ADD image
willyfh Nov 27, 2013
a09bb24
Update Validasi jumlah barang pada checkout
willyfh Nov 27, 2013
2d5d2bd
Update validasi jumlah barang pada checkout
willyfh Nov 27, 2013
b19ffe2
Update Validasi jumlah barang pada checkout
willyfh Nov 27, 2013
afb147a
Update validasi barang HTML5
willyfh Nov 27, 2013
0615c20
Update database
willyfh Nov 27, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1. Buat database dengan nama "datauser" di server
2. Import .sql ke dalam database "datauser"
3. Copykan folder src ke folder public di server, seharusnya /xampp/tomcat/webapps/ jika menggunakan xampp
4. Akses folder tersebut lewat URL, pada umumnya dengan format sebagai berikut localhost:8080/src
3 changes: 3 additions & 0 deletions MEMBER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1. 13511012 Dyah Rahmawati [email protected] DyahRahma
2. 13511052 Ananda Kurniawan Pramudiono [email protected] AnandaKurniawan
3. 13511086 Willy Fitra Hendria [email protected] willyfh
263 changes: 263 additions & 0 deletions db/database.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
-- phpMyAdmin SQL Dump
-- version 3.5.2.2
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Nov 27, 2013 at 03:29 PM
-- Server version: 5.5.27
-- PHP Version: 5.4.7

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `datauser`
--

-- --------------------------------------------------------

--
-- Table structure for table `barang`
--

CREATE TABLE IF NOT EXISTS `barang` (
`IdBarang` int(11) DEFAULT NULL,
`NamaBarang` varchar(20) DEFAULT NULL,
`Harga` int(11) DEFAULT NULL,
`Kategori` varchar(20) DEFAULT NULL,
`Jumlah` int(11) DEFAULT NULL,
`Deskripsi` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `barang`
--

INSERT INTO `barang` (`IdBarang`, `NamaBarang`, `Harga`, `Kategori`, `Jumlah`, `Deskripsi`) VALUES
(1, 'DagingSapi', 80000, 'Daging', 4, NULL),
(2, 'IceCream', 10000, 'Snack', 8, NULL),
(3, 'ChickenNugget', 30000, 'Frozen Food', 8, NULL),
(4, 'BayamItali', 5000, 'Sayuran', 1, 'null'),
(5, 'BerasCarrefour', 11000, 'Beras', 0, 'ini beras carrefour'),
(6, 'DagingYak', 85000, 'Daging', 1, NULL),
(7, 'BerasTajMahal', 25000, 'Beras', 5, 'ini beras tajmahal'),
(8, 'BerasHCSR04', 22000, 'Beras', 1, NULL),
(9, 'BerasRaskin', 7000, 'Beras', 5, 'ini beras raskin'),
(10, 'DagingAyam', 122000, 'Daging', 1, NULL),
(11, 'DagingDomba', 92000, 'Daging', 5, NULL),
(12, 'PetaiCHINA', 2500, 'Sayuran', 1, NULL),
(13, 'SeledriHongkong', 4500, 'Sayuran', 12, NULL),
(14, 'TimunAustralia', 14500, 'Sayuran', 5, NULL),
(15, 'SOZZZZZZIS', 32000, 'Frozen Food', 24, NULL),
(16, 'FIESTANIGGA', 22000, 'Frozen Food', 9, NULL),
(17, 'BAKSOSOGOOD', 28000, 'Frozen Food', 40, NULL),
(18, 'BerasA-KING', 3000, 'Beras', 19, 'null'),
(19, 'DagingBebek', 15000, 'Daging', 8, NULL),
(20, 'SiomayMantap', 20500, 'Frozen Food', 10, NULL),
(21, 'Kangkung', 5300, 'Sayuran', 9, NULL),
(22, 'ToKaeNoi', 5400, 'Snack', 7, NULL),
(23, 'LeoKripikKentang', 3100, 'Snack', 8, NULL),
(24, 'MiGemez', 1200, 'Snack', 19, NULL),
(25, 'Bengbeng', 2050, 'Snack', 9, NULL);

-- --------------------------------------------------------

--
-- Table structure for table `creditcard`
--

CREATE TABLE IF NOT EXISTS `creditcard` (
`number` varchar(50) DEFAULT NULL,
`name` varchar(50) DEFAULT NULL,
`expiredate` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `creditcard`
--

INSERT INTO `creditcard` (`number`, `name`, `expiredate`) VALUES
('12341234', 'budi lagi', '2014-04-07');

-- --------------------------------------------------------

--
-- Table structure for table `transactionlog`
--

CREATE TABLE IF NOT EXISTS `transactionlog` (
`NamaBarang` varchar(20) DEFAULT NULL,
`Harga` int(11) DEFAULT NULL,
`Jumlah` int(11) DEFAULT NULL,
`Username` varchar(20) DEFAULT NULL,
`Kategori` varchar(20) DEFAULT NULL,
`DetailPesanan` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `transactionlog`
--

INSERT INTO `transactionlog` (`NamaBarang`, `Harga`, `Jumlah`, `Username`, `Kategori`, `DetailPesanan`) VALUES
('DagingSapi', 80000, 3, 'budie', 'Daging', NULL),
('DagingSapi', 80000, 2, 'budie', 'Daging', NULL),
('IceCream', 10000, 3, 'budie', 'Snack', NULL),
('IceCream', 10000, 4, 'budie', 'Snack', NULL),
('ChickenNugget', 30000, 1, 'budie', 'Frozen Food', NULL),
('ChickenNugget', 30000, 1, 'budie', 'Frozen Food', NULL),
('BayamItali', 5000, 7, 'budie', 'Sayuran', NULL),
('BerasCarrefour', 12000, 2, 'budie', 'Beras', NULL),
('DagingYak', 85000, 7, 'budie', 'Daging', NULL),
('DagingYak', 85000, 5, 'budie', 'Daging', NULL),
('DagingYak', 85000, 5, 'budie', 'Daging', NULL),
('BerasCarrefour', 12000, 3, 'budie', 'Beras', NULL),
('BerasTajMahal', 25000, 5, 'budie', 'Beras', NULL),
('DagingSapi', 80000, 2, 'budie', 'Daging', NULL),
('DagingAyam', 122000, 3, 'budie', 'Daging', NULL),
('BayamItali', 5000, 2, 'budie', 'Sayuran', NULL),
('PetaiCHINA', 2500, 3, 'budie', 'Sayuran', NULL),
('ChickenNugget', 30000, 2, 'budie', 'Frozen Food', NULL),
('BerasCarrefour', 12000, 1, 'Boci', 'Beras', NULL),
('IceCream', 10000, 2, 'budie', 'Snack', NULL),
('BerasCarrefour', 12000, 2, 'budie', 'Beras', NULL),
('ChickenNugget', 30000, 2, 'budie', 'Frozen Food', NULL),
('BayamItali', 5000, 2, 'yuhustore', 'Sayuran', NULL),
('DagingSapi', 80000, 1, 'budie', 'Daging', NULL),
('BayamItali', 5000, 1, 'budie', 'Sayuran', NULL),
('BerasCarrefour', 12000, 1, 'budie', 'Beras', NULL),
('BerasA-KING', 200, 3, 'budie', 'Beras', NULL),
('BayamItali', 5000, 4, 'budie', 'Sayuran', NULL),
('IceCream', 10000, 1, 'budie', 'Snack', NULL),
('DagingSapi', 80000, 1, 'budie', 'Daging', NULL),
('DagingSapi', 80000, 20, 'budie', 'Daging', NULL),
('DagingYak', 85000, 1, 'aditya2', 'Daging', NULL),
('DagingSapi', 80000, 1, 'aditya2', 'Daging', NULL),
('BayamItali', 5000, 1, 'budie', 'Sayuran', NULL),
('BerasHCSR04', 22000, 1, 'Budie', 'Beras', NULL),
('BerasRaskin', 20000, 1, 'Budie', 'Beras', NULL),
('Kangkung', 5300, 1, 'Budie', 'Sayuran', NULL),
('Kangkung', 5300, 1, 'Budie', 'Sayuran', NULL),
('TimunAustralia', 14500, 1, 'Budie', 'Sayuran', NULL),
('LeoKripikKentang', 3100, 1, 'Budie', 'Snack', NULL),
('IceCream', 10000, 1, 'Budie', 'Snack', NULL),
('Bengbeng', 2050, 2, 'Budie', 'Snack', NULL),
('SiomayMantap', 20500, 1, 'Budie', 'Frozen Food', NULL),
('BAKSOSOGOOD', 28000, 1, 'Budie', 'Frozen Food', NULL),
('DagingHiu', 50000, 1, 'bebek', 'Daging', ''),
('DagingDomba', 92000, 1, 'bebek', 'Daging', ''),
('LeoKripikKentang', 3100, 1, 'bebek', 'Snack', ''),
('BerasHCSR04', 22000, 1, 'bebek', 'Beras', ''),
('BerasCarrefour', 11000, 20, 'bebek', 'Beras', ''),
('BerasCarrefour', 11000, 23, 'bebek', 'Beras', ''),
('BerasCarrefour', 11000, 1, 'bebek', 'Beras', ''),
('BerasCarrefour', 11000, 20, 'bebek', 'Beras', ''),
('BerasCarrefour', 11000, 30, 'bebek', 'Beras', ''),
('BerasTajMahal', 25000, 50, 'bebek', 'Beras', ''),
('BerasRaskin', 7000, 10, 'bebek', 'Beras', ''),
('BerasHCSR04', 22000, 10, 'bebek', 'Beras', ''),
('BerasHCSR04', 22000, 50, 'bebek', 'Beras', ''),
('BerasHCSR04', 22000, 50, 'bebek', 'Beras', ''),
('BerasHCSR04', 22000, 5, 'bebek', 'Beras', ''),
('BerasCarrefour', 11000, 4, 'bebek', 'Beras', ''),
('IceCream', 10000, 4, 'budie', 'Snack', ''),
('DagingSapi', 80000, 4, 'budie', 'Daging', ''),
('DagingDomba', 92000, 2, 'budie', 'Daging', ''),
('DagingYak', 85000, 1, 'budie', 'Daging', ''),
('DagingYak', 85000, 5, 'budie', 'Daging', ''),
('DagingSapi', 80000, 1, 'budie', 'Daging', ''),
('ChickenNugget', 30000, 1, 'budie', 'Frozen Food', ''),
('SOZZZZZZIS', 32000, 1, 'budie', 'Frozen Food', ''),
('ChickenNugget', 30000, 1, 'budie', 'Frozen Food', ''),
('BAKSOSOGOOD', 28000, 2, 'budie', 'Frozen Food', ''),
('FIESTANIGGA', 22000, 6, 'budie', 'Frozen Food', ''),
('BayamItali', 5000, 1, 'budie', 'Sayuran', ''),
('PetaiCHINA', 2500, 1, 'budie', 'Sayuran', ''),
('DagingBebek', 15000, 1, 'budie', 'Daging', ''),
('ToKaeNoi', 5400, 1, 'budie', 'Snack', ''),
('IceCream', 10000, 1, 'budie', 'Snack', ''),
('ChickenNugget', 30000, 1, 'budie', 'Frozen Food', ''),
('DagingSapi', 80000, 1, 'budie', 'Daging', ''),
('DagingYak', 85000, 3, 'budie', 'Daging', ''),
('DagingAyam', 122000, 1, 'budie', 'Daging', ''),
('DagingBebek', 15000, 1, 'budie', 'Daging', ''),
('BayamItali', 5000, 1, 'budie', 'Sayuran', ''),
('PetaiCHINA', 2500, 3, 'budie', 'Sayuran', ''),
('IceCream', 10000, 1, 'budie', 'Snack', ''),
('DagingYak', 85000, 1, 'budie', 'Daging', ''),
('ToKaeNoi', 5400, 1, 'budie', 'Snack', ''),
('BerasCarrefour', 11000, 1, 'budie', 'Beras', ''),
('BerasHCSR04', 22000, 1, 'budie', 'Beras', ''),
('BerasCarrefour', 11000, 5, 'budie', 'Beras', ''),
('ChickenNugget', 30000, 1, 'budie', 'Frozen Food', ''),
('MiGemez', 1200, 4, 'budie', 'Snack', ''),
('Bengbeng', 2050, 1, 'yuhustore', 'Snack', ''),
('LeoKripikKentang', 3100, 1, 'yuhustore', 'Snack', ''),
('Kangkung', 5300, 1, 'yuhustore', 'Sayuran', ''),
('BayamItali', 5000, 4, 'yuhustore', 'Sayuran', ''),
('ChickenNugget', 30000, 1, 'yuhustore', 'Frozen Food', ''),
('PetaiCHINA', 2500, 1, 'yuhustore', 'Sayuran', ''),
('ToKaeNoi', 5400, 1, 'yuhustore', 'Snack', ''),
('MiGemez', 1200, 1, 'yuhustore', 'Snack', '');

-- --------------------------------------------------------

--
-- Table structure for table `user`
--

CREATE TABLE IF NOT EXISTS `user` (
`username` varchar(50) NOT NULL,
`password` varchar(50) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`namalengkap` varchar(50) DEFAULT NULL,
`nohp` varchar(50) DEFAULT NULL,
`provinsi` varchar(50) DEFAULT NULL,
`kotakabupaten` varchar(50) DEFAULT NULL,
`alamat` varchar(50) DEFAULT NULL,
`kodepos` varchar(50) DEFAULT NULL,
`nocredit` varchar(60) DEFAULT NULL,
PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `user`
--

INSERT INTO `user` (`username`, `password`, `email`, `namalengkap`, `nohp`, `provinsi`, `kotakabupaten`, `alamat`, `kodepos`, `nocredit`) VALUES
('aditya', '12345678', '[email protected]', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', '12341234'),
('aditya2', '12345678', '[email protected]', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', '12341234'),
('aditya3', '12345678', '[email protected]', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', '12341234'),
('admin', 'admin123', '[email protected]', 'admin admin', '0000', '-', '-', '-', '0000', NULL),
('bebek', '12345678', '[email protected]', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL),
('budibro', '12341234', '[email protected]', 'budi bro', '0000', 'prov', '-', '-', '0000', NULL),
('budie', '12341234', '[email protected]', 'budi budi', '0', '-', '-', '-', '0', '12341234'),
('budih', '12345678', '[email protected]', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', '12341234'),
('coba2', '12341234', '[email protected]', 'coba dua', '0', '-', '-', '-', '0', '12341234'),
('coba3', '12345678', '[email protected]', 'coba 3', '0', '-', '-', '-', '0', '12341234'),
('cobabaru', '123123123', '[email protected]', 'coba baru', '0', '-', '-', '-', '0', '12341234'),
('cobabro', '12345678', '[email protected]', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL),
('cobadulu', '12345678', '[email protected]', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', '12341234'),
('cobalagi', '12345678', '[email protected]', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL),
('heybro', '12345678', '[email protected]', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL),
('kucing', '12345678', '[email protected]', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', '12341234'),
('lalaye', '12345678', '[email protected]', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL),
('lalayeye', '12345678', '[email protected]', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL),
('popop', '12345678', '[email protected]', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL),
('riandy', '12345678', '[email protected]', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', '123123123'),
('testtest', '12345678', '[email protected]', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL),
('username1', '12345678', '[email protected]', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL),
('username2', '12345678', '[email protected]', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL),
('username4', '12345678', '[email protected]', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL),
('yanti', '12345678', '[email protected]', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', '12341234'),
('yoibro', '12345678', '[email protected]', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4001', NULL),
('yuhustore', '12345678', '[email protected]', 'budi doang', '2134', 'Jawa Barat', 'Bandung', 'Bandung', '4000', '12341234');

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
34 changes: 34 additions & 0 deletions src/AjaxAdd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

function AJAXAdd(bro){

var elem = document.getElementById(bro).elements;
var params = "";
url = "NamaBarangValidationServlet";


for(var i = 0; i < elem.length; i++){
if (elem[i].tagName == "SELECT"){
params += elem[i].name + "=" + encodeURIComponent(elem[i].options[elem[i].selectedIndex].value) + "&";
}else{
params += elem[i].name + "=" + encodeURIComponent(elem[i].value) + "&";
}
}

if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}else{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}

xmlhttp.open("POST",url,false);

xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-length", params.length);
xmlhttp.setRequestHeader("Connection", "close");
xmlhttp.send(params);

return xmlhttp.responseText;



}
34 changes: 34 additions & 0 deletions src/AjaxEdit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

function AJAXEdit(bro){

var elem = document.getElementById(bro).elements;
var params = "";
url = "ENamaBarangValidationServlet";


for(var i = 0; i < elem.length; i++){
if (elem[i].tagName == "SELECT"){
params += elem[i].name + "=" + encodeURIComponent(elem[i].options[elem[i].selectedIndex].value) + "&";
}else{
params += elem[i].name + "=" + encodeURIComponent(elem[i].value) + "&";
}
}

if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}else{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}

xmlhttp.open("POST",url,false);

xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-length", params.length);
xmlhttp.setRequestHeader("Connection", "close");
xmlhttp.send(params);

return xmlhttp.responseText;



}
54 changes: 54 additions & 0 deletions src/AjaxRegister.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@


function AJAXRegister(lol){
var elem2= document.getElementById("cardnumber");
var elem = document.getElementById(lol);

var params = "";
if (lol=="rusername"){
url = "UsernameValidationServlet";
}else if (lol=="email"){
url="EmailValidationServlet";
}else if (lol=="cardnumber"){
url ="CardNumberValidationServlet";
}else if (lol=="namecard"){
url="NameCardValidationServlet";
}else if (lol=="expiredate"){
url="ExpireDateValidationServlet";
}

if (elem.tagName == "SELECT"){
params += elem.name + "=" + encodeURIComponent(elem.options[elem.selectedIndex].value) + "&";
}else{
if (lol=="namecard" || lol=="expiredate"){

params += elem.name + "=" + encodeURIComponent(elem.value) + "&" + elem2.name + "=" + encodeURIComponent(elem2.value) + "&";
}else{
params += elem.name + "=" + encodeURIComponent(elem.value);
}
}


if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}else{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("POST",url,false);

xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

xmlhttp.send(params);

if (xmlhttp.responseText=='true'){

return true;
}else{

return false;
}




}
Loading