Page 1 of 1

Mootools 404 Form.Request

Posted: Tue Jan 25, 2011 4:44 pm
by styks1987
I am getting a very strange problem.

I have two requests being made from two different pages. The two different pages are in the same directory. Both of them make XHR requests using the same function. Both post the exact same URL (verified).

One gives me a 404 error with a response from the page it says is not there. So the file is being processed by the external php script and giving me a processed response.

The other one works without any errors.

I am using Form.Request in Mootools.

Your help is appreciated!

This is a JAVASCRIPT function.

Code: Select all

function send_form(id, table){
	var form = "form_"+id;
	dbug.enable();
	dbug.log($(form));
	new Form.Request($(form), $(form), {
		requestOptions: {
			spinnerOptions: {
				message: 'Sending the form...'
			}
		},
	        onSuccess: function(el){
			dbug.enable();
		        dbug.log('success: ', el);
				el.setStyle('color', '#33CC00');
		},
		extraData: {'update':id, 'table_name': table}
		}).send();
}
This is the form that works

Code: Select all

<tr>
     <td>
	<form id='form_<?php echo $id; ?>' action="<?php echo $saved_dir; ?>" method="post" >
	<table cellpadding=0 cellspacing=0>
		<tr class='top_tr_<?php echo $class." ".$duplicate; ?> top_tr'>
			<td ><a href='javascript:void(0);' onclick='delete_scholarship(this, <?php echo $id; ?>); return false;'>Delete</a></td>
			<td class="<?php echo $id; ?>">
				<input name="industry" type="text" value="<?php echo $scholarship->industry; ?>" />
			</td>
			<td class="<?php echo $id; ?>">
				<input name="company" type="text" value="<?php echo $scholarship->company; ?>" />
			</td>
			<td class="<?php echo $id; ?>">
				<input name="amount" type="text" value="<?php echo $scholarship->amount; ?>" />
		        </td>
			<td class="<?php echo $id; ?>">
				<input name="hours" type="text" value="<?php echo $scholarship->hours; ?>" />
			</td>
			</tr>
			<tr class='bottom_tr_<?php echo $class." ".$duplicate; ?>'>
				<td class="<?php echo $id; ?>">
					<input name="location" type="text" value="<?php echo $scholarship->location; ?>" />
				</td>
		        <td class="<?php echo $id; ?>">
				<input name="state" type="text" value="<?php echo $scholarship->state; ?>" />
			</td>
			<td colspan=2 class="<?php echo $id; ?>">
				<input name="required_services" type="text" value="<?php echo $scholarship->required_services; ?>" />
			</td>
			<td style="width:215px;">
				<input name="save_row" onclick="send_form(<?php echo $id; ?>, 'tuition')" type="button"  value="save row" />
				<span id="save_td_<?php echo $id; ?>"></span>
			</td>
		</tr>
	</table>
</form>
</td>
			</tr>
This is the form that does not

Code: Select all

<tr>
				<td>
				<form id='form_<?php echo $id; ?>' action="<?php echo $saved_dir; ?>" method="post" >
					<table cellpadding=0 cellspacing=0>
					<tr class='top_tr_<?php echo $class." ".$duplicate; ?>'>
						<td><a href='javascript:void(0);' onclick='delete_scholarship(this, <?php echo $scholarship->id; ?>); return false;'>Delete</a></td>
						<td colspan=3  class="<?php echo $id; ?>">
							<input name="name" type="text" value="<?php echo $scholarship->name; ?>" /></td>
						<td class="<?php echo $id; ?>">
							<input name="max_award" type="text" value="<?php echo $scholarship->max_award; ?>" />
						</td>
					</tr>
					<tr class='bottom_tr_<?php echo $class; ?>'>
						<td class="<?php echo $id; ?>">
							<input name="major" type="text" value="<?php echo $scholarship->major; ?>" />
						</td>
						<td class="<?php echo $id; ?>">
							<input name="grade_level" type="text" value="<?php echo $scholarship->grade_level; ?>" />
						</td>
						<td class="<?php echo $id; ?>">
							<input name="state" type="text" value="<?php echo $scholarship->state; ?>" />
						</td>
						<td class="<?php echo $id; ?>">
							<input name="deadline" type="text" value="<?php echo $scholarship->deadline; ?>" />
						</td>
						<td style="width:215px;">
							<input name="save_row" onclick="send_form(<?php echo $id; ?>, 'scholarships')" type="button"  value="save row" />
							<span id="save_td_<?php echo $id; ?>"></span>
						</td>
					</tr>
					</table>
				</form>
			</td>
		</tr>