2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > php提交后刷新父页面 jquery – php ajax表单提交没有刷新父页面

php提交后刷新父页面 jquery – php ajax表单提交没有刷新父页面

时间:2024-05-12 23:02:00

相关推荐

php提交后刷新父页面 jquery – php ajax表单提交没有刷新父页面

我有一些问题的ajax表单提交

$("#send").on("click", function() {

$.ajax({

type: "POST",

url: "ads_process.php",

data: $("#ads").serialize(),

success: function(){

if(data == "true") {

$("#ads").fadeOut("fast", function(){

//$(this).before("

Success! Your message has been sent, thanks!

");

setTimeout("$.ads.close()", 2000);

});

}

}

});

});

一个页面有数据列表,有一个注释按钮,当它点击弹出窗口打开时.我写评论和提交,但问题是,父页面刷新我不想刷新父页面我只想提交数据,插入数据库和弹出窗口将被关闭

和数据将显示在父页面上.

有谁能够帮我

================================================== ===================================

没有发生我发布我的完整代码::

HTML文件::

popup

$("#send").on("click", function() {

events.preventDefault();

$.ajax({

type: "POST",

url: "ads_process.php",

data: $("#ads").serialize(),

success: function(data){

if(data == "true") {

$("#ads").fadeOut("fast", function(){

//$(this).before("

Success! Your message has been sent, thanks!

");

setTimeout("$.ads.close()", 2000);

});

}

}

});

});

Press Esc to close

Agent Name:

Ad ID:

Comments:

Call Reason:

Not Responding at the moment

Busy

Call back

Other Resaons:

Call Status:

Submit

JS文件::

/*

author:

*/

jQuery(function($) {

$("a.topopup").click(function() {

loading(); // loading

setTimeout(function(){ // then show popup, deley in .5 second

loadPopup(); // function show popup

}, 500); // .5 second

return false;

});

/* event for close the popup */

$("div.close").hover(

function() {

$('span.ecs_tooltip').show();

},

function () {

$('span.ecs_tooltip').hide();

}

);

$("div.close").click(function() {

disablePopup(); // function close pop up

});

$(this).keyup(function(event) {

if (event.which == 27) { // 27 is 'Ecs' in the keyboard

disablePopup(); // function close pop up

}

});

$("div#backgroundPopup").click(function() {

disablePopup(); // function close pop up

});

$('a.livebox').click(function() {

alert('Hello World!');

return false;

});

/************** start: functions. **************/

function loading() {

$("div.loader").show();

}

function closeloading() {

$("div.loader").fadeOut('normal');

}

var popupStatus = 0; // set value

function loadPopup() {

if(popupStatus == 0) { // if value is 0, show popup

closeloading(); // fadeout loading

$("#toPopup").fadeIn(0500); // fadein popup div

$("#backgroundPopup").css("opacity", "0.7"); // css opacity, supports IE7, IE8

$("#backgroundPopup").fadeIn(0001);

popupStatus = 1; // and set value to 1

}

}

function disablePopup() {

if(popupStatus == 1) { // if value is 1, close popup

$("#toPopup").fadeOut("normal");

$("#backgroundPopup").fadeOut("normal");

popupStatus = 0; // and set value to 0

}

}

/************** end: functions. **************/

}); // jQuery End

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。