Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Passing Classic ASP values in AJAX

Posted on 2014-09-01
13
Medium Priority
?
358 Views
Last Modified: 2014-09-02
I would like to tie this one off soon if we could.  On this page I am using an array to populate a datatable and I want to pass three values:
1) series id
2) age category
3) gender

The dropdowns are there.  I understand that this is not done via forms.  My dropdowns are:
1) series
2) categories
3) gender

I have learned a ton from this site on this but still having difficulty connecting these dots.

Thanks so much in advance.
0
Comment
Question by:Bob Schneider
  • 8
  • 5
13 Comments
 
LVL 54

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 2000 total points
ID: 40297131
Your jquery would change to
$(document).ready(function() {
var series = 0;
var categories = 0;
var gender = 0;
$('#series').on('change',function(){
  series = $(this).val();
 });
$('#categories').on('change',function(){
  categories = $(this).val();
 });
$('#gender').on('change',function(){
  gender = $(this).val();
 });


    $('#standings').dataTable( {
        'ajax': '/series/results_array-new.asp?series_id='+series+'&gender='+gender+'&year=2014&age_to='+categories;
    } );
  
  
} );

Open in new window

0
 
LVL 54

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 2000 total points
ID: 40297150
Correction

$(document).ready(function() {
var series = 0;
var categories = 0;
var gender = 0;
$('#series').on('change',function(){
  series = $(this).val();
  categories = $('#categories').val();
  gender = $('#gender').val();
   getData(series,categories,gender);
 
 });
$('#categories').on('change',function(){
  series = $('#series').val();
  categories = $(this).val();
 gender = $('#gender').val();
 });
$('#gender').on('change',function(){
   series = $('#series').val();
   categories = $('#categories').val();
  gender = $(this).val();

 });

  function getData(series,categories,gender){
      // for testing
  alert (series+ ' '+gender + ' '+ categories);
   
      $('#standings').dataTable( {
        'ajax': '/series/results_array-new.asp?series_id='+series+'&gender='+gender+'&year=2014&age_to='+categories;
    } );
  

  
  }
  
  
} );

Open in new window

You can see the pop up sending values here http://jsbin.com/yaboro/2/edit
0
 

Author Comment

by:Bob Schneider
ID: 40297167
Thanks, but now how do I convert those in to asp variables on the "receiving" page?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 54

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 2000 total points
ID: 40297173
You already have the reviving page working.  On this page, you are simply sending data.   You had hard coded data and I converted it to use javascript variables.  Those variables are taken from the drop downs.
0
 

Author Comment

by:Bob Schneider
ID: 40297176
Sure, and this may be my ignorance, but the receiving page is drawing it's data from Request.Querystring.  Is that how this is being received?  I assume so but the page is now not rendering.
0
 
LVL 54

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 2000 total points
ID: 40297209
Looks like you are missing the function.  Note the code here http:Q_28509347.html#a40297150 and sample html http://jsbin.com/yaboro/2/edit that does not contain any javascript on the drop downs.
0
 

Author Comment

by:Bob Schneider
ID: 40297337
HI.  So I copied your code exactly as is and it appears to not be working.  Any ideas?
0
 
LVL 54

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 2000 total points
ID: 40297368
Make sure you update the other html code.   Remember you have to take out the js in each of  your selects.  


 <select name="series" id="series" onchange="this.form.submit1.click();">
0
 
LVL 54

Accepted Solution

by:
Scott Fell,  EE MVE earned 2000 total points
ID: 40297432
Start validating your code   http://validator.w3.org/
0
 
LVL 54

Expert Comment

by:Scott Fell, EE MVE
ID: 40298321
I hope that worked for you.  When you start using more javascript, it is important to make sure your code is good as it can be the culprit for what could seem like unrelated js errors.
0
 

Author Comment

by:Bob Schneider
ID: 40298461
Yeah I see a lot of issues with the stuff I pulled down from some third parties as well so I will have to go through that more carefully.  But yes, your assistance helped a lot.  Once I get it "cleaned up" it will be a big help to this utility and to my learning curve with javascript, json, jquery, and ajax.

Thanks so much...
0
 
LVL 54

Expert Comment

by:Scott Fell, EE MVE
ID: 40298542
What you might want to do is recreate the table on a blank page and only deal with the 3 drop downs and table.  That takes all the other stuff out of it.  Once you get the test page to work, if it does not work on the live  page, you know it is the other stuff interfering.  That is how I would attack this.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question