Prepopulating an ASP form without code behind from standard HTML page - javascript

I've been given a task, which I believe my employer is just putting a carrot in front of me and seeing how far I will run.
A vendor has provided us with a form application. This application is in ASP. My task is to see if its possible to Pre-populate this ASP application because we want to host a little 'mini-wizard' questionnaire on our site and when you click submit on the 'mini-wizard' it pre-populates a few fields on the application.
My first question to him was "Do we have access to the ASP code behind to look for parameters passed via Get/Post. - NO
I thought, ok, so there is no way to do it. He then said you may be able to do it with javascript. Which I could see if I could put JS on the application page, but I can't do that either.
My final idea would be to make an ajax call for that page, modify the contents and then display it on our site. I am not sure that would even work, have never tried making an AJAX call to an ASP page from a non-asp site.
Can it be done or is this some form of new developer hazing?

Yes it can be done. As you are going to use client side ajax, the page will give you nothing but the HTML output of that page. So you just need to know that what parameters you need to pass to that page. Even there might be no need to pass parameters.So, Take an asp page of your own and do the ajax call

Related

HTML and JSP - How to initiate an action on a form without moving to another page

I'm trying to create an YouTube website, and everything has already been setup EXCEPT voting up and down.
Is there a way in HTML to create a upvote and a downvote button without changing the current webpage (for example a user is currently watching a video), and initiate a piece of code or a servlet that can perform some logic?
Thanks all, I'm very inexperienced with html, so I'm confused with this step.
Since you are doing this using HTML only. You need to save the data in database but to do that you need to do Jquery magic to post data in some webservice and save in database.
[Working Demo http://jsfiddle.net/ukrs7/12/][1]
You can see the Upvote downvote JQuery logic in above fiddle,
You need to enhance this with saving in database.
You can do this by running some JavaScript on the button click events which sends an AJAX call to the server.
Google around for some exampes of AJAX calls, it's not very difficult to do. You will need to write some server-side code to handle to up/down vote requests but the fact that the requests were sent via AJAX rather than by submitting a form on the page doesn't make much difference.

Get parameter from another page using javascript?

I have a wordpress site, and i'm not a php developer and not very eager to start either so I'm avoiding it like the plague, but I do have a requirement that requires a little bit of extra coding. I need to:
go to a different website,
download that page,
check for a certain phrase,
if phrase exists, extract a link from that page
and if link is returned I need to show that link on my wordpress site.
Currently, I have an asp.net page that does this and i'm hosting that page in an iframe on my wordpress site. but i'd like to do it without an iframe.
Question is, is there anyway for javascript to go to a different page (my asp.net page) and get a parameter (link) from it. If link is provided i will show certain content on wordpress site.
Or can javascript download a text file from the server? problem with that is i need a trigger to update the text file.
Any advice is appreciated.
Thanks.
What you should understand is that by "avoiding [PHP] like the plague" you're inadvertently avoiding the proper way of doing things. Javascript is a client-side language, and PHP is a server-side language. By asserting that you only want the load on the client's end (the kind of logic involved in what you want to do isn't exactly lightweight), you can potentially end up with a VERY slow webpage.
Not to mention, this type of situation is analogous to using a hammer to do a backhoe's job.
Either way, to answer your question, yes. You can use the jQuery Load method in tandem with Javascript's Match method.
What you should TRY to do, however, is make a CURL request using PHP, and then cache the page on your server. By doing this, you will limit the number of calls to a given page, and optimize load times.
Please consider the second option, even as an attempt in good practice. Good luck.
Use ajax and connect to a different page (on your server) which is written in server-sided language (like asp.net, as you said), that connects to the remote website.
More about Ajax

call live webservice from simple html page...?

I read lots of post here, but don't get specific answer.
I have live server on which I have my web services work properly.
now, I want to create one simple html page through which I call that web service.
with javascript this is possible but what is exact.
I repeat again only html and javascript through which I want to call that web service.
you can use jquery to load the data from webservice, but you might need to include jquery js file and your browser(IE) might prompt for security violation and you might need to click yes.

HTML Snippet Generator - Javascript

I'm trying to write a system that will produce HTML snippets for users dependant on what they choose from a number of options.
Each user will have a unique ID (already in SQL DB) which links to the options they are allowed to select from.
Does anyone have any ideas how I should go about doing this? The pages are ASP.NET C# but I'd prefer to use HTML, JQuery & Javascript for the UI. However I do need to pull the relevant info from SQL.
Thanks for any replies!
No problem using html & jquery for the ui.
You can just create a the basic site layout in asp and take advantage of masterpages to limit duplicating your work with any cross page content.
You can add form controls to the pages in asp but don't use server side controls.
Use the regular html form controls so you don't get any post back on user input.
Server side controls will look like this:
<input type=text runat=server ...
the "runat=server" in the tag will cause a post back on the server. Not something you will want if you're planning on using javascript for the ui.
Once your page is set up then you can attach your javascript/jquery to those html form controls and use ajax to query the db to limit the user selections.
With response to your comments:
So if user logs onto system and sees a number of logo and text variations they can download, I would use ajax to query which combinations the user has access to and with that info, dynamically create the download button/link using javascript.
That way no redirect/page refresh etc. is required and the user has a nice interface that you can bling up with jquery.
I'm not sure how you're seeing the user vs sql vs asp required. From my viewpoint:
asp - setup the page.
ajax - pull options user has access to.
javascript - dynamically create the download links.
jquery - make it look nice.
I get using asp if you're extending a system and you kinda have to use it. I've run into that situation way too many times. But if its a new system, I don't see the point of going asp. Never really liked it and probably never will but that just an opinion and shouldn't be taken for much.
Good luck
Populate the appropriate HTML content from your database, based on user selection via jQuery AJAX

get data from asp page

I am wondering if there is anyway to grab the html that is generated from an ASP page. I am trying to pull a table from the page, and I foolishly used a static html page so I would not have to be constantly querying the server where this page resides while I tested out my code. The javascript code I wrote to grab to unlabeled table from the page works. Then when I put it into practice with the real page and found that the ASP page does not generate a viewable page with a jquery .get request on the URL.
Is there any way to query the page for the table I need so that the ASP page returns a valid page on request?
(I am also limited to using javascript and perl for this, the server where this will reside will not run php and I have no desire to learn ASP.NET to solve this by adding to the issue of proprietary software)
Use Perl's LWP module to query the ASP.NET page to get the required information. I would open the target page in a web browser while doing a WireShark trace so you can tell exactly how the browser is calling the page and getting the table information, and then perform the same call with LWP.
Is the page that is trying to get the table on the same domain? It needs to be. If not you have to use a proxy or XMLHttpRequest Level 2 access control headers.

Categories

Resources