当前位置: 动力学知识库 > 问答 > 编程问答 >

jQuery UI dialog automatically closing

问题描述:

My parent page invokes a jQuery UI dialog.

In the dialog, I have some form elements and a button with title 'Accept'.

The data, for now, is posted to a spring controller that handles the post and at present does nothing with the data while I am trying to gather some insight of the behavior.

This is my page that is called in the jQuery UI dialog:

<form method="post" action="">

//some stuff

<button onclick="captureData()">Accept</button>

</form>

function captureData(){

$.ajax({

url: '/captureData.json',

data: {unmae:UserNmae},

type: 'post',

success: function() {

alert("success");

},

error: function() {

alert("error");

}

});

}

The data is posted to the spring controller, however what I notice is that after the alert("success"); the dialog closes on its own.

I'm trying to locate as to what and why the dialog closes on its own.

网友答案:

The suggestion from @ cherhan was the solutions. Use of return false

分享给朋友:
您可能感兴趣的文章:
随机阅读: