0

I am able to open a html page with jquery ui dialog.

This is my code

var openDialog = $( "#dialog" ).dialog({
  height:500,
  width:500,
  modal: true,
  buttons: {
    Cancel: function() {
      $( this ).dialog( "close" );
    }
  }
});

openDialog.load("testPage.html").data("userID",this.model.userID).dialog('open');

I need to send data [ a couple of values] to testPage.html and tried using the the data as shown above and tried retriveing it in my testPage.html using

var test =  $("#dialog").data("userID");
alert(test);

Which clearly seems the wrong way to go. Is there a way to do this?

user1361914
  • 411
  • 1
  • 14
  • 26
  • sounds like you're trying to pass params ... have a look at these 2 http://stackoverflow.com/questions/9539150/passing-parameters-to-jquery-ui-dialog and http://stackoverflow.com/questions/394491/passing-data-to-a-jquery-ui-dialog – carrabino May 16 '13 at 17:39

1 Answers1

0

I would construct a query string with the data you want to send the testPage.html, then have some code on testPage.html to read the query string and do whatever with the values.

This should help, its just a function to get the values out of the Query string.

function getParameterByName(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
    results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}

Hope this helps.

recneps
  • 1,285
  • 5
  • 16
  • 27
  • Actually this is not working as the url does not change as I am using jqueryu ui dialog and invoking page in it with querystring values. i keep getting null on values i know are part of the query string [verified in fiddler] – user1361914 May 16 '13 at 19:51