rocky
  •  rocky
  • 55.4% (Neutral)
  • YAF Forumling Topic Starter
2013-10-17T10:12:08Z
Hello Team,

Now i am developing a web method for deal with database and after that i want to call it from Jquey Ajax.So,how it can be possible.Please suggest me soon.


Thanks


Regards,
Rocky Tom
Sponsor
tha_watcha
2013-10-17T11:10:30Z
Quote:

Now i am developing a web method for deal with database and after that i want to call it from Jquey Ajax.So,how it can be possible.Please suggest me soon.



YAF uses Ajax for some functions (for example the thanks function) the web service is under Classes\YafAjax.cs you could add your own code there.

PS: Please stop spaming the forum by posting the same question over and over again
UserPostedImage
rocky
  •  rocky
  • 55.4% (Neutral)
  • YAF Forumling Topic Starter
2013-10-17T13:39:44Z
Thanks for valuable reply,

But unfortunately issue is not closed right now.
Actually, i want to call a web method through Ajax.
But,it can't be done in my side.I already used code as you told example "thanks function".
Here,web service is running properly but it can't be called by Ajax.

Hopefully now the real issue is clear with you.

Thanks
tha_watcha
2013-10-18T10:26:57Z
Originally Posted by: rocky 

Hopefully now the real issue is clear with you.



No its not, all the methods in the YafAjax.cs class are called via jquery ajax. If i understand correctly that is what you want to do.



UserPostedImage
rocky
  •  rocky
  • 55.4% (Neutral)
  • YAF Forumling Topic Starter
2013-10-18T11:25:40Z
Yes you are too correct it is.
But the think is that how it can i did means first what i have to do,
please define steps one by one ? Actually, i am new here and in c#.
Right now that defined code i am using to call web method but its not called (YafAjax.asmx/myWebMethod).


$.ajax({
type: "POST",
url: 'YafAjax.asmx/myWebMethod',
data: "{':'"Parameter_value"'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
alert("success");
},
error: function (result) {
alert("error");
}
});


Please reply soon.
Thanks
tha_watcha
2013-10-18T12:10:58Z
you need to parse paremeter name and value


$.ajax({
 type: "POST",
 url: 'YafAjax.asmx/myWebMethod',
 data: {"parameter_name": "Parameter_value"},
 contentType: "application/json; charset=utf-8",
 dataType: "json",
 success: function (data) {
 alert("success");
 },
 error: function (result) {
 alert("error");
 }
 });

UserPostedImage
rocky
  •  rocky
  • 55.4% (Neutral)
  • YAF Forumling Topic Starter
2013-10-18T12:43:49Z
Thanks,for your instant reply,its appreciable.

But,its not working on my YAF application for doing customization .
Is there some other way to do these same ? .
tha_watcha
2013-10-20T05:46:26Z
Originally Posted by: rocky 

Thanks,for your instant reply,its appreciable.

But,its not working on my YAF application for doing customization .
Is there some other way to do these same ? .



Which browser did you use, each browser as a javascript error output. The javascript console should tell you if there are an error.


UserPostedImage

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved