L
L
Lesssmoke2018-05-03 13:36:40
safari
Lesssmoke, 2018-05-03 13:36:40

Why doesn't inserting elements into the DOM work on the iPhone?

There is a JS function that works correctly on all devices except those on IOS. Mobile devices such as the IPhone pose a particular problem . The project has a number of similar functions, but they all die at the stage of embedding new content in the DOM (on IOS). Request to the server and response - it works correctly. The data is passed and it can even be displayed with an alert, but as soon as it comes to .html(), everything falls apart. He himself does not have any IOS devices, so there is no way to describe the situation more specifically.

Tell me what's wrong here? In which direction to move?

function loadbag(){
    $.ajax({
        type: "POST",
        url: "functions/loadbag.php",
        dataType: "html",
        cache: false,
        success: function(data){
            data = JSON.parse(data);
            if($(window).width() > 770){
                $("#bag-point").html(' ' + data["main"]);
            } else if(data["alt"] != null){
                $("#bag-point").html(' ' + data["alt"]);
            }  else if(data["alt"] == null){
                $("#bag-point").empty();
            }
        }
    });
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lesssmoke, 2018-05-17
@Lesssmoke

The problem is solved, it was the work of the script caching system on IOS

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question