Answer the question
In order to leave comments, you need to log in
Ajax request, how to pass value?
I make a bunch of goods, i.e. I tie one to the other.
$id = intval( $_REQUEST['id'] );
$list = "";
$result = $db->query( "SELECT * FROM ".PREFIX."_stol_post WHERE id!=''" );
if( $db->num_rows( $result ) > 1 )
{
while( $row = $db->get_row( $results ) )
{
$ids = $row['id'];
$title = htmlspecialchars( stripslashes( $row['title'] ), ENT_QUOTES, $config['charset'] );
$list .= <<<HTML
HTML;
}
}
else
{
$list = "<option>Нет банков</option>";
}
$list = <<<HTML
<form name="mainoffers" method="post" action="" onsubmit="SetFormSubmit( 'mainoffers' ); return false;">
<div class="col-sm-4">
<input type="text" id="add_Post_{$id}" value="{$ids}" name="{$ids}" style="text-align: center; width: 50px;" class="form-control">
</div>
<div class="col-sm-4">
<li><a onclick="AddPost( '{$id}' ); return false;" href="#"> связать</a></li>
</div>
</form>
HTML;
echo $list;
function AddPost( id ){
var Quest = confirm( "Привязать данный товар" );
if( Quest )
{
document.getElementById( "StatusIDPost_" + id ).innerHTML = "привязывается";
$.ajax({
url: "/ajax/admin/post/add.post.php",
data: "value=" + value,
success: function( data ){
$( "#LightWindow-content" ).html( data );
},
dataType: "html",
type: "POST"
});
}
}
$id = intval( $_REQUEST['id'] );
if( $id )
{
$result = $db->query( "SELECT * FROM ".PREFIX."_vaza_post WHERE `id`='{$id}'" );
if( $db->num_rows( $result ) > 0 )
{
while( $row = $db->get_row( $result ) )
{
$db->query( "UPDATE ".PREFIX."_vaza_post SET `vaza_tovar`='{$value}' WHERE `id`='{$id}' LIMIT 1" );
}
}
else
{
echoReturn( "Указанный товар не найден, возможно он был удален ранее!" );
}
}
else
{
echoReturn( "Не указан идентификатор товара!" );
}
Answer the question
In order to leave comments, you need to log in
Some kind of mess of letters and scraps of thoughts...
You send by Ajax data: "value=" + value,
, and it's not clear where it came from, catch on the server $_REQUEST['id']
, which is absent there. What is there to attach to what is even unrealistic to understand ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question