-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscripts.js
More file actions
45 lines (45 loc) · 1.43 KB
/
Copy pathscripts.js
File metadata and controls
45 lines (45 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
$(document).ready(function(){
$("form").submit( function() {
var params = {};
$(this)
.find("input[@type='text'], input[@type='password'], select")
.filter(":enabled").each(function() {
params[ this.name || this.id || this.parentNode.name || this.parentNode.id ] = this.value;
});
$.ajax({
type: "POST",
url : this.getAttribute("action"),
data : params,
dataType : "json",
success : function(json){
if (json.type != 1) alert (json.text);
else
{
$("#result").slideDown("slow");
$("#c").html(json.package.c);
$("#o").html(json.package.o);
$("#q").html(json.package.q);
$("#pcost").html(json.package.pcost);
$("#ucost").html(json.package.ucost);
if (json.package.packages != 0)
{
$("#totals").fadeIn("slow");
$("#packages").html(json.package.packages);
$("#tc").html(json.package.tc);
$("#to").html(json.package.to);
$("#tq").html(json.package.tq);
$("#tcost").html(json.package.tcost);
$("#lgross").html(json.package.lgross);
$("#lnet").html(json.package.lnet);
}
}
},
error : function (){ alert("Error contacting server."); }
});
$("#result").hide();
$("#totals").hide();
return false;
});
$("#howmany, #oprice, #cprice, #grade, #type").keypress(function(){ $("#result").hide(); })
$("#type").keypress(function(){ $("#span.ore").append($(($("#type").val() == "ss")? "Soul" : "Spirit")); })
});