S
S
SeiLove2015-11-16 16:31:07
PHP
SeiLove, 2015-11-16 16:31:07

Cross-domain submission of data from a form?

I configured .htaccess correctly (in any case, it no longer swears). The scheme is as follows:
Site1 - has a form, its js-handler on Site2, exactly like the form for processing the result.
JS-validation of the form on the site2 side works. But the data is empty and does not come... maybe I made a mistake in the code?

This is how sending data in JS looks like

$.post("http://сайт1/форма.php", { n: n1},
    function(data){	$("#mess").html(data);});

So their acceptance in the form...
$name = mysql_real_escape_string(strip_tags($_POST['n']));  
/*итд, стандартно*/


Am I passing them wrong or is this impossible to implement? There can be no errors in the form, on the site1 itself it is working ... I doubt the method of transmission ..

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Azim Kurt, 2015-11-16
@Symphony

crossDomain parameter:
true

$.ajax({
    crossDomain: true,
    type:"GET",
    contentType: "application/json; charset=utf-8",
    async:false,
    url: "http://<your domain>/hello",
    data: {projectID:1},
    dataType: "jsonp",                
    jsonpCallback: 'successCallback'
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question