我有一个网站,我使用saleforce.com。
这是我的代码:
function salesforce() {
var first_name = $("#first_name_new").val();
var last_name = $("#last_name_new").val();
var coupon_code = $("#coupon_code_new").val();
var phone = $("#phone_new").val();
var email = $("#email_new").val();
var state = $("#state_new").val();
var oid = "00DU0000000HB32";
var retURL = "http://www.testsite.com";
var debug = "1";
var debugEmail = "arnold@gmail.com";
//alert(first_name_new+"/"+last_name+"/"+coupon_code+"/"+phone+"/"+email+"/"+state);
$.ajax({
type: "POST",
dataType: 'jsonp',
url: "https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8",
data: { first_name: first_name, last_name: last_name, phone: phone, email:email, state:state, oid:oid, debug:debug, debugEmail:debugEmail },
success:function(data){
contactSent = "true";
},
error:function(data){
contactSent = "true";
}
});
}
我只需按一下按钮就可以调用此功能:
$(function(){
$('.next-product').click(function(){
salesforce();
});
});
这是按钮:
<button class="next-product">Next</button>
当我点击按钮时,它会在错误中显示错误:
SyntaxError: unexpected end of XML source
<BR><BR>Your request has been queued.<BR><BR>Record Information:<BR><BR>_: 1345203119160<BR>callback: jQuery172007126272654237087_1345203087782<BR>debug: 1<BR>debugEmail: arnold@gmail.com<BR>email: mariya@galtech.org<BR>encoding: UTF-8<BR>first_name: ttt<BR>last_name: tttteee<BR>oid: 00DU0000000HB32<BR>phone: 1234567896<BR>state: kerala<BR>
我该如何解决这个问题?
编辑:
这是我使用的页面中的整个代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>TradeYourWreck.com | Wrecked Car? Don't sell it… Fix it</title>
<link href="tyw.css" rel="stylesheet" type="text/css" />
<link type="text/css" href="css/redmond/jquery-ui-1.8.21.custom.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="js/ajaxupload.3.5.js" ></script>
<script type="text/javascript" src="http://www.carqueryapi.com/js/carquery.0.3.3.js"></script>
<!--[if lte IE 7]>
<style>
.content { margin-right: -1px; } /* this 1px negative margin can be placed on any of the columns in this layout with the same corrective effect. */
ul.nav a { zoom: 1; } /* the zoom property gives IE the hasLayout trigger it needs to correct extra whiltespace between the links */
</style>
<![endif]-->
<script type="text/javascript">
$(document).ready(
function()
{
//Create a variable for the CarQuery object. You can call it whatever you like.
var carquery = new CarQuery();
//Run the carquery init function to get things started:
carquery.init();
//Optionally, you can pre-select a vehicle by passing year / make / model / trim to the init function:
//carquery.init('2000', 'dodge', 'Viper', 11636);
//Optional: Pass sold_in_us:true to the setFilters method to show only US models.
carquery.setFilters( {sold_in_us:true} );
//Optional: initialize the year, make, model, and trim drop downs by providing their element IDs
carquery.initYearMakeModelTrim('car-years', 'car-makes', 'car-models', 'car-model-trims');
//Optional: set the onclick event for a button to show car data.
$('#cq-show-data').click( function(){ carquery.populateCarData('car-model-data'); } );
//Optional: initialize the make, model, trim lists by providing their element IDs.
carquery.initMakeModelTrimList('make-list', 'model-list', 'trim-list', 'trim-data-list');
//Optional: set minimum and/or maximum year options.
carquery.year_select_min=1980;
carquery.year_select_max=2012;
//Optional: initialize search interface elements.
//The IDs provided below are the IDs of the text and select inputs that will be used to set the search criteria.
//All values are optional, and will be set to the default values provided below if not specified.
var searchArgs =
({
body_id: "cq-body"
,default_search_text: "Keyword Search"
,doors_id: "cq-doors"
,drive_id: "cq-drive"
,engine_position_id: "cq-engine-position"
,engine_type_id: "cq-engine-type"
,fuel_type_id: "cq-fuel-type"
,min_cylinders_id: "cq-min-cylinders"
,min_mpg_hwy_id: "cq-min-mpg-hwy"
,min_power_id: "cq-min-power"
,min_top_speed_id: "cq-min-top-speed"
,min_torque_id: "cq-min-torque"
,min_weight_id: "cq-min-weight"
,min_year_id: "cq-min-year"
,max_cylinders_id: "cq-max-cylinders"
,max_mpg_hwy_id: "cq-max-mpg-hwy"
,max_power_id: "cq-max-power"
,max_top_speed_id: "cq-max-top-speed"
,max_weight_id: "cq-max-weight"
,max_year_id: "cq-max-year"
,search_controls_id: "cq-search-controls"
,search_input_id: "cq-search-input"
,search_results_id: "cq-search-results"
,search_result_id: "cq-search-result"
,seats_id: "cq-seats"
,sold_in_us_id: "cq-sold-in-us"
});
carquery.initSearchInterface(searchArgs);
//If creating a search interface, set onclick event for the search button. Make sure the ID used matches your search button ID.
$('#cq-search-btn').click( function(){ carquery.search(); } );
});
</script>
<script type="text/javascript">
var contactSent = "false";
$(function(){
//$("#tabVPhoto").hide();
$("#tabPkg").hide();
$('#tabs').tabs({
fx: {
opacity: 'toggle'
}
});
});
function lookupVIN() {
//console.log("lookup vin");
var car_vin = $("#car-vin").val();
$.ajax({
type: "GET",
url: "vin.php",
data: { car_vin: car_vin },
success:function(data){
//console.log(data);
$("#vinDet").html(data);
//vinDet
},
error:function(data){
}
});
}
function salesforce() {
var first_name = $("#first_name").val();
var last_name = $("#last_name").val();
var phone = $("#phone").val();
var email = $("#email").val();
var state = $("#state").val();
var oid = "00DU0000000HB32";
var retURL = "http://www.tradeyourwreck.com";
var debug = "1";
var debugEmail = "arnold@vemark.com";
$.ajax({
type: "POST",
dataType: 'jsonp',
url: "https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8",
data: { first_name: first_name, last_name: last_name, phone: phone, email:email, state:state, oid:oid, debug:debug, debugEmail:debugEmail },
success:function(data){
contactSent = "true";
},
error:function(data){
contactSent = "true";
}
});
}
$(function(){
$('.next-product').click(function(){
var index = jQuery('#tabs').data('tabs').options.selected;
//console.log(contactSent);
var pkg = $('input:radio[name=pkg]:checked').val();
/*
if(pkg=="self") {
$("#tabVPhoto").show();
$("#tabVCond").show();
$("#self").show();
$("#inspect").hide();
}else {
$("#tabVPhoto").hide();
$("#tabVCond").hide();
$("#self").hide();
$("#inspect").show();
//alert('inspect');
}
*/
var $tabs = $('#tabs').tabs();
var selected = $tabs.tabs('option', 'selected');
$tabs.tabs('select', selected+1);
if(index==0) {
if(contactSent == "false"){
salesforce();
}
}
})
$('.previous-product').click(function(){
var index = jQuery('#tabs').data('tabs').options.selected;
//console.log(index);
var pkg = $('input:radio[name=pkg]:checked').val();
if(pkg=="self") {
$("#tabVPhoto").show();
$("#tabVCond").show();
}else {
$("#tabVPhoto").hide();
$("#tabVCond").hide();
//alert('inspect');
}
var $tabs = $('#tabs').tabs();
var selected = $tabs.tabs('option', 'selected');
$tabs.tabs('select', selected-1);
})
$( '.next-product').button({
text: true,
icons: {
primary: "ui-icon-seek-next"
}
});
$( '.previous-product' ).button({
text: true,
icons: {
primary: "ui-icon-seek-prev"
}
});
});
$(function(){
var cntUp = 0;
var btnUpload=$('#upload');
var status=$('#status');
new AjaxUpload(btnUpload, {
action: 'upload-file.php',
name: 'uploadfile',
onSubmit: function(file, ext){
if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext))){
// extension is not allowed
alert('Only JPG, PNG or GIF files are allowed');
return false;
}
status.text('Uploading...');
},
onComplete: function(file, response){
//On completion clear the status
status.text('image uploaded');
cntUp++;
//console.log(cntUp);
//Add uploaded file to list
if (response.toLowerCase().indexOf("success") >= 0 ) {
//alert('success');
$('<li></li>').appendTo('#files').html('<img src="uploads/'+file+'" alt="" /><br />'+file).addClass('success');
} else{
$('<li></li>').appendTo('#files').text(file).addClass('error');
//alert('error');
}
}
});
});
</script>
</head>
<body>
<div class="container">
<div class="header">
<nav id="access" role="navigation">
<div class="menu-top-menu-container">
<ul id="menu-top-menu" class="menu">
<li id="menu-item-30" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-25 current_page_item menu-item-30"><a href="index.php">Home</a></li>
<li id="menu-item-21" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-21"><a href="about.php">About TradeYourWreck.com</a></li>
<li id="menu-item-22" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22"><a href="inquiries.php">Inquiries</a></li>
</ul>
</div>
</nav>
<a href="index.php"> <img src="images/header1.jpg" width="1000" height="163" alt=""> </a> </div>
<?php include 'inc/sidebar.php'; ?>
<div class="content">
<div style="width:675px; margin: 0 auto; margin-top:10px; font-size:12px;" id="tabs">
<ul>
<!--<li id="tabPkg"><a href="#tabs-1">Select Your Package</a></li> -->
<li id="tabVInfo"><a href="#tabs-2">Contact Information</a></li>
<li id="tabVCond"><a href="#tabs-3">Vehicle Information</a></li>
<li id="tabVPhoto"><a href="#tabs-4">Additional Vehicle Information</a></li>
<li id="tabVCheck"><a href="#tabs-5">Check Out</a></li>
</ul>
<div id="tabs-2">
<input type=hidden name="oid" value="00DU0000000HB32">
<input type=hidden name="retURL" value="http://www.tradeyourwreck.com">
<input type="hidden" name="debug" value=1>
<input type="hidden" name="debugEmail" value="arnold@vemark.com">
<!--<input type="hidden" name="debugEmail" value="jweeks@thoughtwm.com">-->
<table cellpadding="3">
<tr>
<td>First Name</td>
<td><input id="first_name" maxlength="40" name="first_name" size="20" type="text" /></td>
</tr>
<tr>
<td>Last Name</td>
<td><input id="last_name" maxlength="80" name="last_name" size="20" type="text" /></td>
</tr>
<tr>
<td>Phone</td>
<td><input id="phone" maxlength="40" name="phone" size="20" type="text" /></td>
</tr>
<tr>
<td>Email Address</td>
<td><input id="email" maxlength="80" name="email" size="30" type="text" /></td>
</tr>
<tr>
<td>State/Province</td>
<td><input id="state" maxlength="20" name="state" size="20" type="text" /></td>
</tr>
<tr>
<td> </td>
<td><button class="previous-product">Previous</button>
<button class="next-product">Next</button></td>
</tr>
</table>
</div>
<div id="tabs-3">
<!-- -->
<table cellpadding="3">
<tr>
<td valign="top">VIN</td>
<td>
<!-- test VINS:
1GDGG31Z4RF513458<br/>
KMHCG45C31U211444<br/>
2MEFM75W7YX721741<br/>
-->
<input class="frmIn" size="30" value="" name="car-vin" id="car-vin" type="text" value="" />
<input onclick="lookupVIN()" name="btnVin" type="button" value="Lookup" />
<br/>
<div id="vinDet"></div></td>
</tr>
<tr>
<td>Year</td>
<td><select name="car-years" id="car-years">
</select></td>
</tr>
<tr>
<td>Make</td>
<td><select name="car-makes" id="car-makes">
</select></td>
</tr>
<tr>
<td>Model</td>
<td><select name="car-models" id="car-models">
</select></td>
</tr>
<!--<tr>
<td>Trims</td>
<td><select name="car-model-trims" id="car-model-trims"></select></td>
</tr>
<tr>
<td>Color</td>
<td><input class="frmIn" name="car-color" type="text" value="" /></td>
</tr>
<tr>
<td>Mileage</td>
<td><input class="frmIn" name="car-mileage" type="text" value="" /></td>
</tr>
<tr>
<td>Repair Estimate</td>
<td><input class="frmIn" name="car-estimate" type="text" value="" /></td>
</tr>
<tr>
<td>Reserve Price</td>
<td><input class="frmIn" name="car-reserve" type="text" value="" /></td>
</tr>
<tr>
<td>Secondary Damage</td>
<td><input class="frmIn" name="car-damage" type="text" value="" /></td>
</tr>
<tr>
<td>Comments</td>
<td><textarea class="frmIn" name="car-comment" cols="20" rows="5"></textarea></td>
</tr>-->
<tr>
<td> </td>
<td><button class="previous-product">Previous</button>
<button class="next-product">Next</button></td>
</tr>
</table>
</div>
<div id="tabs-4">
<table cellpadding="3">
<tr>
<td>Repair Estimate</td>
<td><input class="frmIn" name="car-estimate" type="text" value="" /></td>
</tr>
<tr>
<td>Reserve Price</td>
<td><input class="frmIn" name="car-reserve" type="text" value="" /></td>
</tr>
<tr>
<td>Primary Damage</td>
<td><select name="car-damage">
<option value="Center Rear">Center Rear</option>
<option value="Chemical Spill">Chemical Spill</option>
<option value="Dash Fire">Dash Fire</option>
<option value="Engine">Engine</option>
<option value="Engine Fire">Engine Fire</option>
<option value="Fallen Tree">Fallen Tree</option>
<option value="Fresh Water">Fresh Water</option>
<option value="Hail Damage">Hail Damage</option>
<option value="Hard Roll">Hard Roll</option>
<option value="Interior Fire">Interior Fire</option>
<option value="Left Front">Left Front</option>
<option value="Left Rear">Left Rear</option>
<option value="Left Side">Left Side</option>
<option value="Lite Fire Damage">Lite Fire Damage</option>
<option value="Lite Roll">Lite Roll</option>
<option value="Medium Roll">Medium Roll</option>
<option value="None">None</option>
<option value="Right Front">Right Front</option>
<option value="Right Rear">Right Rear</option>
<option value="Right Side">Right Side</option>
<option value="Rolled">Rolled</option>
<option value="Roof">Roof</option>
<option value="Salt Water">Salt Water</option>
<option value="Theft Heavy Strip">Theft Heavy Strip</option>
<option value="Theft Lite Strip">Theft Lite Strip</option>
<option value="Theft Recovery">Theft Recovery</option>
<option value="Total Burn">Total Burn</option>
<option value="Undercarriage">Undercarriage</option>
<option value="Vandalized">Vandalized</option>
<option value="Transmission">Transmission</option>
<option value="Center Front">Center Front</option>
<option value="Mechanical">Mechanical</option>
</select></td>
</tr>
</table>
<div style="margin-top:15px;" id="mainbody" >
<div id="upload" style="margin-bottom:10px;" ><span>Upload Photos<span></div>
<!--<span id="status" >status</span> -->
<ul id="files" >
</ul>
<button class="previous-product">Previous</button>
<button class="next-product">Next</button>
</div>
</div>
<div id="tabs-5">
<div id="self">
<!-- <table border="0">
<tr>
<td><form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="U3XMXN3S94BB6">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form></td>
</tr>
<tr>
<td><img src="images/packages_img1.png" width="286" height="95" alt="Let us Do The work" /></td>
</tr>
</table> -->
</div>
<div id="inspect">
<table border="0" cellpadding="0">
<tr>
<td><form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="U3XMXN3S94BB6">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form></td>
<td><img src="images/packages_img1.png" width="286" height="95" alt="Let us Do The work" /></td>
</tr>
<tr>
<td><form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="XEEB6CNLRWJAJ">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form></td>
<td><img src="images/packages_img2.png" width="286" height="95" alt="Let us Do The work" /></td>
</tr>
</table>
<!-- <table border="0">
<tr>
<td align="center"><form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="XEEB6CNLRWJAJ">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form></td>
</tr>
<tr>
<td><img src="images/packages_img2.png" width="286" height="95" alt="Let us Do The work" /></td>
</tr>
</table>
--> </div>
</div>
</div>
</div>
<p> </p> </div>
<?php include 'inc/footer.php'; ?>
</body>
</html>