ASP.NET 1.1 Web Services and jQuery

Posted March 5th, 2010 in asp.net, jQuery, javascript, webdev by Alex Barberis

While working on a project today I figured out how to use jQuery’s $.ajax functionality to consume an ASP.NET 1.1 web service. I was always under the impression that this wasn’t possible. However, this is quite easy. By default an ASP.NET 1.1 web service will accept an HTTP GET, HTTP POST, or HTTP SOAP. Calling a 1.1 web service is as easy as:

$.ajax({
	type: "POST",
	url: 'PathToYourService.asmx/FunctionName',
	data: 'foo1=value1&foo2=value&foo3=value',
	dataType: "xml",
	success: function(xml) {
		//do something with your data
	}
});

Replace the data variables with your service parameters and you should be all set. jQuery makes parsing all that XML really easy as well.

infoBar 1.0

Posted March 11th, 2009 in jQuery, javascript by Alex Barberis

I created a simple plugin for jQuery that displays an information bar that looks similar to what most browsers are doing to show messages to a user today. I needed to create something that showed my custom messages when necessary. Total development time on top of jQuery was about 15 minutes. This is the best framework ever!

infoBar is easy to use. Here is what you do:

showInfoBar(‘This is a sample information bar!’);

Once the infoBar shows and the user clicks the close link on the right theĀ hideInfoBar(); function is called. This is automatically wired up. All you have to do is display the bar and everything else just works.

infoBar also resizes when the user resizes the browser and always stays on the top of the browser when the user scrolls the page.

I really dislike doing CSS so its all customizable inside the script. You just need to include it and you’re all set. Feel free to modify my script. Hopefully the next version gets support for an icon on the left and I will fancy up the close link.

Confirmed to work in IE7, Chrome, and Safari.

Demo of infoBar

infoBar at the jQuery Plugin Repository (download available)

Enjoy!

Edit:

Blake Pell took infoBar.js and wrapped it to create an ASP.NET control that can be used on your site. Go check it out.