0

I'm not an expert in jQuery/ajax - but I work with Classic ASP.

I'm using this Gender API - https://gender-api.com/en/ to discover the gender of an user based on his first name.

They had an API/jQuery plugin:

https://gender-api.com/en/jquery-plugin

The API has a limit of free use.

Because of this my idea is to get the gender of each user when he log on the site and record the gender on the SQL table.

Then when the same user returns - I only read my SQL table - and no more the API (reducing the free use)

My great problem is, how can I get the gender result with this jQuery plugin (I think this will return the result on client) if all ASP code will work on server?

It's possible? Any ideas?

Thanks a lot!

Update 1:

I got the gender using ajax:

$.get( "https://gender-api.com/get?name=Daniel", function( data ) {
  $( "body" )
    .append( data.gender ); //
}, "json" );

This will append the gender on html body..

I think the best way to send this gender to ASP is to redirect the page to another "Update.asp" page - like: "update.asp?gender=xxx"

How can I redirect the page usign jquery?

DANIEL
  • 515
  • 7
  • 20
  • Please ask questions in ALL-CAPS, it is annoying and distracting. –  Oct 15 '15 at 04:53
  • Collecting the gender of a user without their consent may breach the data protection laws of particular countries. It's not difficult to write your own gender discovery program using your own data, once you have enough entries in the list. – Paul Oct 15 '15 at 07:33
  • Hi, @Paul - tks! I dont need the gender for "pure information" - man or female - but to customize the feedback page with correct words. In English we dont have this problem, because for any gender we had the same word to refer. But in my language some words are different - and my client wants (because he wants..hehehe) the correct word for each gender. Of course in some cases the name will not recognized - for these cases I will print all "male" words. Then I need to know only female names with 90% of accurancy to print the correct "female" words on screen. – DANIEL Oct 15 '15 at 11:05
  • with this API I can recognize this names, with XX% accurancy to identify female names and print on screen only "female" words - and offer a more accurate treatment for each client. – DANIEL Oct 15 '15 at 11:07
  • You could call the webservice directly in your asp code using `MSXML2.ServerXMLHTTP` http://stackoverflow.com/questions/11388714/how-do-i-use-msxml2-serverxmlhttp-to-grab-data-from-another-site Should you really want to redirect from the client you can use `window.location=Update.asp?gender=xxx` http://stackoverflow.com/questions/503093/how-can-i-make-a-redirect-page-using-jquery – schudel Oct 15 '15 at 14:40
  • hi @schudel tks a lot for your time and help! I'll test your tip. During all day I work with this script (as I said, Jquery/Java isn't so easy for me..) but I can understand how some scripts works, and I got the answer to get the gender on client and resend this to SQL with ASP. But your tip if works, maybe the best way to do this interaction between Ajax and Asp. Tks a lot! Daniel – DANIEL Oct 15 '15 at 21:42

0 Answers0