简体   繁体   中英

HTML redraw with ajax issue in PHP project

I'm working on a PHP assignment and having trouble getting an ajax call to properly redraw. Everything almost works except I have this one line of code that keeps giving me errors:

$line .= '<input type="button" onclick="$j(this).attr(\'disabled\',true).val(\'Updating...\');xajax_save_message(' . $error . ',' . '$j(\'#error_' . $error_code . '\').val());return false;" id="save_button_' . $error_code . '" value="Save" />';

I think I have an escape character in the wrong place. Currently, the error message that I'm getting is:

XML Parsing Error: not well-formed
Location: http://127.0.0.1/dev/admin_eprescribing_error_messages.php
Line Number 1, Column 63:

The error occurs when I actually push the button to save. As I said, this is a PHP project which uses a library called Xajax to do ajax calls.

Any help would be great.

$j = "$"."j";
    $line .= '<td align="left">';
    $line.= <<<DELIMETER
    <input type="button" onclick="$j(this).attr('disabled',true).val('Updating...');xajax_save_message({$error_code},$j('#error_message{$error_code}').val());return false;" id="save_button_{$error_code}" value="Save" />;
    DELIMETER;
    $line .= '&nbsp';

You should use

$j = "$"."j";
$line.= <<<DELIMETER
<input type="button" onclick="$j(this).attr('disabled',true).val('Updating...');xajax_save_message({$error},$j('#error_{$error_code}).val());return false;" id="save_button_{$error_code}" value="Save" />;
DELIMETER;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM