Hi ,

I am totally new to programming in javescript .My purpose is to call a python file in javascript .The python script inturn calls a database function .Javascript acts as a web interface to insert data into the postgres db .

There are several fields (string and numbers) in the form and a submit button . After entering data in the form and when the user presses the 'submit' button the main.js makes the follwing Ajax call .But it is not working.

The call is

[code]
function submitForm(event)
{
name =document.getElementById("name");
Location=document.getElementById("Location");
if(this.checkFields(name,Location))
{
var u = 'http://url/test.py'
var dataStr = 'name=' +name.value + '&Location=' +Location.value
$.ajax({
url: u,
datatype: 'xml',
data: dataStr,
type: 'POST',
success: function(xml){
name=$("name",xml).text();
Location=$("Location",xml).text();
var status = $("result",text).find('status').text()
return checkstatus(status);
}
});
}

function checkstatus(status)
{
if(status == "Success" )
{
clearFields
} else{
alert("Enter valid values")
}
}

[code]
The problem is the no insertion of data happens into the database and the xml file is empty .

Even though all the values are provided into the form it always goes to 'Enter valid values' .

And in the python file there is a statement like
print "Content-type:text/xml\r\n\r\n"
Before the database conenction is closed the following sttaement is print from the python file

[code in python]
print '<result>'
if au == True
print '<status>Success</status>'
else:
print '<status>Fail</status>'
print '</result>'

[code in python]

I am trying this in a safari browser .This is urgent .Any help is truly appreciated .

And when I execute the URL in the variable u its working fine and data is getting inserted into the database .Only when I am inserting from the form I have a problem .



Thanks