- Beranda
- Komunitas
- Tech
- Website, Webmaster, Webdeveloper
mohon bantuan submit form dengan AJAX


TS
anomanom
mohon bantuan submit form dengan AJAX
gan numpang tanya nih,,,,
ane ada script kaya dibawah
index.php
<html>
<head><title>Select Chain</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
var htmlobjek;
$(document).ready(function()
{
//apabila terjadi event onchange terhadap object <select id=region>
$("#region").change(function()
{
\tvar region = $("#region").val();
$.ajax(
\t{
\turl: "GetMSC.php",
data: "region="+region,
cache: false,
success: function(msg)
\t\t{ \t//jika data sukses diambil dari server kita tampilkan
//di <select id=kota>
$("#msc").html(msg);
}
});
});
$("#sub_but").click(function()
{
\t
\t$.ajax(
\t\t{
\turl: "ShowSCR.php",
\t\t\ttype: GET,
\tdata: $(this).serialize(),
\tcache: false,
\tsuccess : function(data)
\t\t\t{
\t$("#scr").html(data);
}
\t\t});
});
});
33\t
</script>
</head>
<body>
<?php
include "conn.php";
include "q_table.php";
?>
<form name="scr_form" id="scr_form">
<table border="2">
<tr>
\t<td>
\t\t<table>
\t\t <tr>
\t\t <td>
\t\t <font size="-1">Date From<br> </font>
\t\t <input type="text" name="datefrom" id="datefrom">
\t\t <a href="javascript:void(0)" onClick="if(self.gfPop)gfPop.fPopCalendar(document.scr_form.datefrom);return false;">
\t\t <img name="popcal" align="absmiddle" style="border:none" src="./calender/calender.jpeg" width="34" height="29" border="0" alt="">
\t\t </a>
\t\t </td>
\t\t </tr>
\t\t</table>
\t</td>
\t<td>
\t\t<table>
\t\t <tr>
\t\t <td>
\t\t <font size="-1">Date To<br> </font>
\t\t <input type="text" name="dateto" id="dateto">
\t\t <a href="javascript:void(0)" onClick="if(self.gfPop)gfPop.fPopCalendar(document.scr_form.dateto);return false;">
\t\t <img name="popcal" align="absmiddle" style="border:none" src="./calender/calender.jpeg" width="34" height="29" border="0" alt="">
\t\t </a>
\t\t </td>
\t\t </tr>
\t\t</table>
\t</td>
\t<td>
\t\t<table>
\t\t <tr>
\t\t <td>
\t\t<font size="-1">Region <br></font>
\t\t<select name="region" id="region">
\t\t<option value="0" selected="selected">--Pilih Region--</option>
\t\t<option value="AllReg"> <b>All Region</b> </option>
\t\t<?php
\t\t\twhile($p=mssql_fetch_array($q_region)){
\t\t\techo "<option value=\"$p[0]\">$p[1]</option>
";
\t\t\t}
\t\t?>
\t\t</select>
\t\t </td>
\t\t </tr>
\t\t</table>
\t</td>
\t<td>
\t\t<table>
\t\t <tr>
\t\t <td>
\t\t<font size="-1">MSC <br></font>
\t\t<select name="msc" id="msc">
\t\t\t<option selected="selected">--Pilih MSC--</option>
\t\t</select>
\t\t </td>
\t\t </tr>
\t\t</table>
\t</td>
\t<td align="center">
\t\t<input type="submit" value="Process" name="proses" id="sub_but">
\t</td>
</tr>
</table>
</td>
</form>
<br>
<div id="scr">
</div>
</body>
</html>
<!-- PopCalendar(tag name and id must match) Tags should not be enclosed in tags other than the html body tag. -->
<iframe width=174 height=189 name="gToday:normal:./calender/agenda.js" id="gToday:normal:./calender/agenda.js" src="./calender/ipopeng.htm" scrolling="no" frameborder="0" style="visibility:visible; z-index:999; position:absolute; top:-500px; left:-500px;">
</iframe>
ShowSCR.php
<?php
include "conn.php";
$datefrom = $_GET['datefrom'];
$dateto = $_GET['dateto'];
$region = $_GET['region'];
$msc = $_GET['msc'];
if($msc == 'AllMsc'
{
\t$q_msc2 = mssql_query("SELECT distinct DATE_ID, HOUR_ID, MSC, (SUM(Success_16/Attempt_16)*100) as SCR_16
FROM SCR
WHERE DATE_ID >= '$datefrom'
and DATE_ID <= '$dateto'
group by DATE_ID, HOUR_ID, MSC,Success_16,Attempt_16");
}elseif($msc != 0 or $msc != 'AllMsc'
{
\t$q_msc2 = mssql_query("SELECT distinct DATE_ID, HOUR_ID, MSC, (SUM(Success_16/Attempt_16)*100) as SCR_16
\tFROM SCR
\tWHERE msc_id='$msc'
\tAND DATE_ID >= '$datefrom'
AND DATE_ID <= '$dateto'
\tgroup by DATE_ID, HOUR_ID, MSC,Success_16,Attempt_16");
}
\techo "$datefrom";
\techo "$dateto";
\techo "$region";
\techo "$msc";
echo "
\t\t\t
\t\t\t<table border='2' width='50%'>
\t\t\t\t<tr align='center'>
\t\t\t\t\t<td><b>Date</b></td>
\t\t\t\t\t<td><b>Time</b></td>
\t\t\t\t\t<td><b>MSC</b></td>
\t\t\t\t\t<td><b>SCR 16bit(%)</b></td>
\t\t\t\t</tr>";
while($k = mssql_fetch_array($q_msc2))
{
$date_1 = date("Y-m-d", strtotime($k[DATE_ID]));
echo "
\t\t\t\t<tr>
\t\t\t\t\t<td align='center'><font size='-1'>$date_1</font></td>
\t\t\t\t\t<td align='center'><font size='-1'>$k[HOUR_ID]</font></td>
\t\t\t\t\t<td align='center'><font size='-1'>$k[MSC]</font></td>
\t\t\t\t\t<td align='center'><font size='-1'>$k[SCR_16]</font></td>
\t\t\t\t</tr>
\t\t\t
\t\t\t
\t\t\t
\t\t";
}
\techo "</table>";
\t
?>
kok data submit dari form yang ada di index.phpga bisa kekirim ke file ShowSCR.php ya gan??
mohon pencerahannya gan,,ane udah mumet banget, hampir 2 1 minggu ga nemu2 nih caranya
ane ada script kaya dibawah
index.php
Quote:
<html>
<head><title>Select Chain</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
var htmlobjek;
$(document).ready(function()
{
//apabila terjadi event onchange terhadap object <select id=region>
$("#region").change(function()
{
\tvar region = $("#region").val();
$.ajax(
\t{
\turl: "GetMSC.php",
data: "region="+region,
cache: false,
success: function(msg)
\t\t{ \t//jika data sukses diambil dari server kita tampilkan
//di <select id=kota>
$("#msc").html(msg);
}
});
});
$("#sub_but").click(function()
{
\t
\t$.ajax(
\t\t{
\turl: "ShowSCR.php",
\t\t\ttype: GET,
\tdata: $(this).serialize(),
\tcache: false,
\tsuccess : function(data)
\t\t\t{
\t$("#scr").html(data);
}
\t\t});
});
});
33\t
</script>
</head>
<body>
<?php
include "conn.php";
include "q_table.php";
?>
<form name="scr_form" id="scr_form">
<table border="2">
<tr>
\t<td>
\t\t<table>
\t\t <tr>
\t\t <td>
\t\t <font size="-1">Date From<br> </font>
\t\t <input type="text" name="datefrom" id="datefrom">
\t\t <a href="javascript:void(0)" onClick="if(self.gfPop)gfPop.fPopCalendar(document.scr_form.datefrom);return false;">
\t\t <img name="popcal" align="absmiddle" style="border:none" src="./calender/calender.jpeg" width="34" height="29" border="0" alt="">
\t\t </a>
\t\t </td>
\t\t </tr>
\t\t</table>
\t</td>
\t<td>
\t\t<table>
\t\t <tr>
\t\t <td>
\t\t <font size="-1">Date To<br> </font>
\t\t <input type="text" name="dateto" id="dateto">
\t\t <a href="javascript:void(0)" onClick="if(self.gfPop)gfPop.fPopCalendar(document.scr_form.dateto);return false;">
\t\t <img name="popcal" align="absmiddle" style="border:none" src="./calender/calender.jpeg" width="34" height="29" border="0" alt="">
\t\t </a>
\t\t </td>
\t\t </tr>
\t\t</table>
\t</td>
\t<td>
\t\t<table>
\t\t <tr>
\t\t <td>
\t\t<font size="-1">Region <br></font>
\t\t<select name="region" id="region">
\t\t<option value="0" selected="selected">--Pilih Region--</option>
\t\t<option value="AllReg"> <b>All Region</b> </option>
\t\t<?php
\t\t\twhile($p=mssql_fetch_array($q_region)){
\t\t\techo "<option value=\"$p[0]\">$p[1]</option>
";
\t\t\t}
\t\t?>
\t\t</select>
\t\t </td>
\t\t </tr>
\t\t</table>
\t</td>
\t<td>
\t\t<table>
\t\t <tr>
\t\t <td>
\t\t<font size="-1">MSC <br></font>
\t\t<select name="msc" id="msc">
\t\t\t<option selected="selected">--Pilih MSC--</option>
\t\t</select>
\t\t </td>
\t\t </tr>
\t\t</table>
\t</td>
\t<td align="center">
\t\t<input type="submit" value="Process" name="proses" id="sub_but">
\t</td>
</tr>
</table>
</td>
</form>
<br>
<div id="scr">
</div>
</body>
</html>
<!-- PopCalendar(tag name and id must match) Tags should not be enclosed in tags other than the html body tag. -->
<iframe width=174 height=189 name="gToday:normal:./calender/agenda.js" id="gToday:normal:./calender/agenda.js" src="./calender/ipopeng.htm" scrolling="no" frameborder="0" style="visibility:visible; z-index:999; position:absolute; top:-500px; left:-500px;">
</iframe>
ShowSCR.php
Quote:
<?php
include "conn.php";
$datefrom = $_GET['datefrom'];
$dateto = $_GET['dateto'];
$region = $_GET['region'];
$msc = $_GET['msc'];
if($msc == 'AllMsc'

{
\t$q_msc2 = mssql_query("SELECT distinct DATE_ID, HOUR_ID, MSC, (SUM(Success_16/Attempt_16)*100) as SCR_16
FROM SCR
WHERE DATE_ID >= '$datefrom'
and DATE_ID <= '$dateto'
group by DATE_ID, HOUR_ID, MSC,Success_16,Attempt_16");
}elseif($msc != 0 or $msc != 'AllMsc'

{
\t$q_msc2 = mssql_query("SELECT distinct DATE_ID, HOUR_ID, MSC, (SUM(Success_16/Attempt_16)*100) as SCR_16
\tFROM SCR
\tWHERE msc_id='$msc'
\tAND DATE_ID >= '$datefrom'
AND DATE_ID <= '$dateto'
\tgroup by DATE_ID, HOUR_ID, MSC,Success_16,Attempt_16");
}
\techo "$datefrom";
\techo "$dateto";
\techo "$region";
\techo "$msc";
echo "
\t\t\t
\t\t\t<table border='2' width='50%'>
\t\t\t\t<tr align='center'>
\t\t\t\t\t<td><b>Date</b></td>
\t\t\t\t\t<td><b>Time</b></td>
\t\t\t\t\t<td><b>MSC</b></td>
\t\t\t\t\t<td><b>SCR 16bit(%)</b></td>
\t\t\t\t</tr>";
while($k = mssql_fetch_array($q_msc2))
{
$date_1 = date("Y-m-d", strtotime($k[DATE_ID]));
echo "
\t\t\t\t<tr>
\t\t\t\t\t<td align='center'><font size='-1'>$date_1</font></td>
\t\t\t\t\t<td align='center'><font size='-1'>$k[HOUR_ID]</font></td>
\t\t\t\t\t<td align='center'><font size='-1'>$k[MSC]</font></td>
\t\t\t\t\t<td align='center'><font size='-1'>$k[SCR_16]</font></td>
\t\t\t\t</tr>
\t\t\t
\t\t\t
\t\t\t
\t\t";
}
\techo "</table>";
\t
?>
kok data submit dari form yang ada di index.phpga bisa kekirim ke file ShowSCR.php ya gan??
mohon pencerahannya gan,,ane udah mumet banget, hampir 2 1 minggu ga nemu2 nih caranya
0
1.3K
Kutip
2
Balasan


Komentar yang asik ya
Urutan
Terbaru
Terlama


Komentar yang asik ya
Komunitas Pilihan