Response title
This is preview!
var pjax_e=0; | |
function swapContent(href, url_data, target, loads) { | |
$.ajax({ | |
type: 'GET', | |
cache: false, | |
url: href+'?' + url_data, //add a variable to the URL that will carry the value in your i counter through to the PHP page so it know's if this is new or additional data | |
success: function (data) { // this param name was confusing, I have changed it to the "normal" name to make it clear that it contains the data returned from the request | |
//load more data to "target" value div | |
target.innerHTML = (data); // as above, data holds the result of the request, so all the data returned from your results.php file are in this param but please see below | |
} | |
.done(function( msg ) { | |
//runs functions required for new view processing | |
loads | |
}); | |
.fail(function() { | |
//error processing | |
pjax_e++; | |
if (pjas_e<10){ | |
target.innerHTML = "error"+pjax_e; | |
setTimeout( swapContent(href, url_data, target, loads), 500 ); | |
} else{ | |
target.innerHTML = "we are currently experiencing a server error, please retry"; | |
} | |
}) | |
.always(function() { | |
//url goes in here | |
window.history.pushState({"html":response.html,"pageTitle":response.pageTitle},"", urlPath); | |
}); | |
}) | |
} |
<div id='dialog' title='Blog Post Viewer'></div>
- $(function() {
- $( "#dialog" ).dialog({
- autoOpen: false
- });
- });
- function run_modal( href, url_data ) {
- $("#dialog").dialog("open");
- // alert(href+"="+url_data);
- }
It comes up with this bug: jquery-2.1.4.js:250 Uncaught Error: cannot call methods on dialog prior to initialization; attempted to call method 'open'
What am I doing wrong to trigger the dialog call?
Is there a way you would suggest changing the title, and body content on a single ajax call to the server?
function run_modal(catagory, item) {
// alert(catagory +'*'+ item);
//modal code for output
$( "#modal" ).dialog({
//modal content in here
title:"this is only a test",//title of modal box
width: 300,
height: 300,
modal: false,
ui-dialog-content:"text",
});
}
© 2013 jQuery Foundation
Sponsored by and others.