views:

53

answers:

3

I'm doing a short AJAX project, and I'd like to use Visual Studio 2010. It's just xHTML and JavaScript, with calls to a serverside .php file. What is the best way to set up a project/solution for this in VS? I see a lot of project templates having to do with ASP.NET.

Also, when I choose to Add New Item, I get "Ajax Client Control", "Ajax Client Behavior", etc as a file template. What's that? Is it worth using when I expect only to spend ~5 hours on this project? Or should I just make a blank JavaScript file, like I'm used to?

(Right now, I choose to make a project of the template Empty C# Web App. This seems dubious.)

+3  A: 

Don't mess around with the Items marked as AJAX. Those are controls for the ASP.NET AJAX Toolkit and won't help you here.

Your best bet is to stick to jQuery and make your AJAX calls to the *.php scripts that way.

In this case, .NET isn't even really needed...it's all HTML and Javascript (using jQuery unless you're feeling adventurous).

...if you really want to shoehorn some .NET in to the picture and overcomplicate things, you could add a Web Reference to the *.php services and then use the .NET AJAX Toolkit to force the server to make the call to the PHP service. I don't condone doing it this way, it just makes things more complicated.

Justin Niessner
Yeah, I don't want .NET. I just want pure xHTML and JS. In that case, what project setup do I want?
Rosarch
Also, I'm trying to **Add New Item** but can't find JavaScript as a template. (Does JScript work?)
Rosarch
A: 

Do you really need a VS-project at all for this? Just create the files you need and drag them into VS for editing, syntax highlighting and other goodies, and never mind the project/solution :)

Otherwise an empty project of any kind should be fine - you're not going to compile/publish it through VS right?

SilverSkin
Well, I did see some feature where it looked like VS would publish it to the server for me. But aside from that, the only features I'm after are syntax highlighting and intellisense. So should I start over in an empty project?
Rosarch
A: 

I'm going to assume that you have a localhost webserver which handles your php file which and is already configured to work with php. So the easiest way to do this is to open Visual Studio, click Shift + Alt + O (this opens a website). Navigate to the folder where your php file is located.

This will load the folder into the solution explorer. You can now rick click on the project and add new item (html page and jscript in your case).

You should now be set to do some ajax magic. To test your page, just open your browser, goto your localhost/phpAjaxFolder/ajaxPage.html and see what happens.

(I've made a lot of assumptions here, but this should be the general way of working with your project.)

Hope this helps some and have fun.

Chris