Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi!

I'm having problems figuring out the path of the web page where I'm inserting a double click on a canvas.

The web page is in a folder, and I have been trying alot of paths to access that webpage but I can't find the correct one.

JavaScript
function dblClick(e) {
           canvas = document.getElementById("myCanvas");
           var newX = e.x - canvas.offsetLeft;
           var newY = e.y - canvas.offsetTop;
           $.ajax({
               type: "POST",
               url: "../Admin/CreateMap.aspx/DoubleClick()",
               data: JSON.stringify({ x: newX, y: newY }),
               contentType: "application/json; charset=utf-8",
               dataType: "json",
               success: function (data) {
                   eval(data.d);
               },
               error: function (msg) {
                   alert(msg);
               }
           });


This is my script. Any help?
Posted
Updated 29-May-14 2:43am
v2

remove () from
JavaScript
url: "../Admin/CreateMap.aspx/DoubleClick()",


just write
JavaScript
url: "../Admin/CreateMap.aspx/DoubleClick",
 
Share this answer
 
Comments
developerjm 29-May-14 9:12am    
Thank for your reply.
I have already tried that and it did not work!
Nirav Prabtani 30-May-14 3:38am    
press F12 and see error in inspect element
Instead of making the path relative to the jscript file, make it relative to the root folder of your URL or use ResolveURL.

See this article about an alternative for ResolveURL in ASP.NET ... ResolveUrl in ASP.NET - The Perfect Solution[^]
 
Share this answer
 
Comments
developerjm 30-May-14 7:45am    
Thanks :)
CHill60 30-May-14 8:14am    
Did that work?
developerjm 30-May-14 8:14am    
Both worked, thank you :)
VB
"../Admin/CreateMap.aspx/DoubleClick()" is invalid url

remove "()"
 
Share this answer
 
Comments
CHill60 30-May-14 3:30am    
Which is exactly what Solution 1 said, and the OP commented that it didn't work
EnnoMiao 30-May-14 4:43am    
1.comfirm the url is right,
2.add timestamp data: JSON.stringify({ x: newX, y: newY,abc:Math.random()}),
2.Clear the cache
developerjm 30-May-14 7:44am    
Thank you :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900