C
C#2y ago
x0rld

✅ ASP.NET and jQuery + AJAX calls

the best way is to do with controllers and return a json
16 Replies
Annointed
Annointed2y ago
Hmm gotcha, do you mind providing an example by any chance?
Annointed
Annointed2y ago
Thank you
Angius
Angius2y ago
This is Webforms The ancient shit
Annointed
Annointed2y ago
It would still be okay to do it via Webforms though right
Angius
Angius2y ago
I don't think WebAPI tutorial will help lol
Annointed
Annointed2y ago
LOL
x0rld
x0rldOP2y ago
you can use webapi + webform 🤔
Annointed
Annointed2y ago
But I don't need WebAPI. I just need to populate this
Angius
Angius2y ago
Well, usually you call an API with JS It hasn't changed since the days of olde when jQuery and Webforms were relevant Excapt it used to be SOAP, now it's REST
Annointed
Annointed2y ago
Gotcha
Angius
Angius2y ago
Maybe there is some Webforms-specific way
Annointed
Annointed2y ago
@ZZZZZZZZZZZZZZZZZZZZZZZZZ So in my code-behind, would I serialize the fileNames, but how can I call it with the jQuery
Angius
Angius2y ago
Wouldn't surprise me if there was some automagical runat=jquery thing or someshit I haven't used jQuery in ages, sorry But you would... get the response from the Ajax call Parse it somehow And use that To, uh, add elements with jQuery However that works
Annointed
Annointed2y ago
Makes sense, I guess I'm just stuck on the calling part haha, I'll look into it more Thanks a bunch
Angius
Angius2y ago
Oh calling the API should be easy $.get('/the/url', response => { /* do stuff */}) if my memore serves me

Did you find this page helpful?