-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading automatically from AJAX #22
Comments
Hi, I'm not sure I understand the question, you can attach your code to this topic, and I will try to resolve this problem. |
Thanks for your reply. This works and I am able to save and load successfully. I have also replaced the url/drag and drop section for loading images with a select menu of predefined images, this also works as expected. What I would like is for the restore function to fire as soon as an image has been selected and loaded onto the canvas, instead of having to click 'load'. When I tried this however it kept loading the hotspots in a loop and layering them on top of eachother. Thanks #loadurl is a hidden field with the filename of the image which is currently loaded into the canvas var localStorageWrapper = (function() {
var KEY_NAME = 'SummerHTMLImageMapCreator';
return {
save : function() {
var result = areasIO.toJSON();
console.log(areasIO);
$.ajax({
url: 'savedata.php',
type: 'post',
data: {model:KEY_NAME,result:result},
success: function(data){
console.info('Saved in Database');
alert('Saved');
}
});
},
restore : function() {
var namefromfield=$("#loadurl").val();
namefromfield=namefromfield.split('|');
var imgurl=namefromfield[0];
var getmodelname=namefromfield[1];
$.ajax({
url: 'getdata.php',
type: 'post',
data: {imgurl:imgurl,model:getmodelname},
success: function(data){
console.log(data);
areasIO.fromJSON(data);
}
});
}
};
})(); |
I need to see all changes, incl. menu of predefined images |
Hi there
Firstly thank you for what you have created, it is ideal for my current project.
I do have a question though. I have added the ability to save and load to a database via AJAX, which works fine. As the filename for the image also saves in the database when I click load it loads up the hotspots relevant to that image which is great.
What I am looking to do is remove the need to click the load button, and instead have the hotspots load automatically depending on what image is selected.
I managed to get this to work but it seemed to get caught in a loop and loaded hundreds of the hotspots on top of eachother. Do you know how this can be accomplished? Thanks
The text was updated successfully, but these errors were encountered: