0

can anybody say "how i can pass jSon Data from jQuery dialog form to Parent form?" I want to create a search window where user will select client name then selected client name and id will appear in parent form using ASP.net MVC 3.

Thanks in advance.

2
  • Can you post your markup please?
    – karim79
    Aug 20, 2011 at 6:15
  • in principle, dialog deals return "a" value ok, cancel etc. and parent can reach properties (or methods) to dialog before close (or closed). If you need this, there is many sample. Aug 20, 2011 at 11:09

2 Answers 2

0

JQUERY Dialog is not a separated window. You can access all parent's elements from dialog window using their names or IDs or some other attribute. Consider you want to send your JSON data to a javascript function. Some code lines like what I wrote here can help you:

<script>
    $(function() {
    $( "#dialog-confirm" ).dialog({
        resizable: false,
        height:140,
        modal: true,
        buttons: {
        "Yes": function() {
            $( this ).dialog( "close" );
            some_javascript_function(JSON_DATA);
        },
        "No": function() {
            $( this ).dialog( "close" );
        }
    }
    });
</script>

No matter you write above script in the HTML file or a separated js file, you just need to be sure that your javascript function is known there.

-1

Why does it need to be json? You can just set the elements via javascript directly.

document.getElementById("SomeTextBox").value = "xyz";

You may have to reference the parent using parent.document see this for more details:

http://thedesignspace.net/MT2archives/000105.html#.Tk9WrVuCrxE

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.