﻿/*
*   Author: Ashok S
*   Created: 23/6/2010
*   Last modified: 
    Description: Mangages the user's current taxonomy details
*/

var redirectURL = '';

//AJAX success calllback function
function AjaxSucceeded(result) {
    window.location = redirectURL;
}

//AJAX error callback function
function AjaxFailed(xmlHttp, status, exceptionObj) {
    //alert(xmlHttp.responseText)
    alert('There was an error processing the request')
}

//Saves the currrent taxonomy details to session via json ajax webservice
function setTaxonomy(domainID, fieldID, specialtyID, url) {

    $.ajax({
        type: "POST",
        url: "/_layouts/service/Taxonomy.asmx/SaveTaxonomy",
        data: "{'domainID': '" + domainID + "', 'fieldID': '" + fieldID + "', 'specialtyID': '" + specialtyID + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) {
            AjaxSucceeded(msg);
        },
        error: AjaxFailed
    });

    redirectURL = url;
    return false;
}