Hi. I'm a bit confused here...Perhaps someone here can help me?
I have a fancybox popup (which is a div within my page/ NOT an iframe/
external page).
The popup has a "save" button, which I want to do the following:
a) some validation that proper values were entered in the fancybox
popup. Some of this validation is even with jquery ajax.
b) if everything is valid, close the fancybox & postback the page.
Everything works, except the postback.
I DON'T want to call the postback onclosed of the fancybox, like
this:
'onClosed': function () {
__doPostBack('SOMETHING HERE', '');
}
...because I only want the page to refresh if all the validation was
successful...
Here's my code so far:
BUTTON THAT OPENS FANCYBOX POPUP:
$(".copyProd").fancybox({
'showCloseButton': true,
'href': '#copyProdOverlay'
});
SAVE BUTTON WITHIN FANCYBOX POPUP:
$("#copyProdSaveBtn").click(function () {
var copy_fields = "";
//determine which fields to copy (based on checked
checkboxes)
$
(this).closest('table').find("input:checked").each(function () {
copy_fields = copy_fields + $(this).attr('id') +
"|";
});
//if NOTHING is checked, error
if (copy_fields == "") {
alert("ERROR! No sections selected to be
copied.");
}
else {
var copy_prod_name = $("#copyProdTextbox").val();
if (copy_prod_name == "") {
alert("ERROR! You must enter a product to be
copied.");
}
else {
//check if copy_prod_name is valid product:
$.ajax({
type: "POST",
url: "/ProductMaintenance/Services/
Validate.asmx/ValidateProduct",
dataType: "json",
data: "{mas_alias: \'" + copy_prod_name +
"\'}",
contentType: "application/json;
charset=utf-8",
success: function (response) {
if (response != null && response.d !=
null) {
var data = response.d;
if (data == true) {
$.fancybox.close();
__dopostback('ImagesUpdatePanel', '');********************PROBLEM LINE
}
else {
alert("Invalid Product.");
}
}
} //ends success function
});
}
}
});
I GET AN ERROR: "__dopostback is not defined"
Also, it seems to be failing, even in the "onClosed" when I do some of
the other
asp.net buttons as the event_target...But I really don't
just want the ImagesUpdatePanel....I really basically want a full
refresh with some parameter that I know it came from this copy
button.