first: I want to show the returning data with an Ajax request in my Jquery UI message box. and second: in the code below the message box appears just for 1 second. I dont know why!!!!!
<script>
$(document).ready(function(){
$("#dialog-confirm").dialog({
autoOpen:false,
resizable: false,
height:140,
modal: true,
buttons: {
"Ok": function() {
$( this ).dialog( "close" );
}
}
});
$("#customer_form").submit(function(){
$.get("../ajax/Services.php?Add=Add, function(data){
if (data) {
$("#dialog-confirm").dialog("open");
}
});
});
});
</script>
<body>
<div id="dialog-confirm" title="MY TITLE">
<p>
SOME TEXT <span class="ui-icon ui-icon-alert"
style="float:right; margin:0 7px 20px 0;"></span>
</p>
</div>
</body>
If you want “SOME TEXT” to be what gets replaced with
data, you need to wrap it in aspanso that you can select just that element without affecting the icon next to it:For the second issue it’s likely that what you’re seeing is a new page getting loaded.
You need to prevent the
submitaction from following through and really submitting.